Repository navigation
Add an external backend option to the AWS emulator - #411
Merged
Merged
Conversation
Set aws.backend.url to proxy those services to an AWS-compatible endpoint such as AWS Emulator, keeping the emulator's port and path prefixes. Cognito and the inspector stay local. Seeded resources are created through the backend's API once per emulator start. The AWS SDK e2e suites can also target an external endpoint through AWS_EMULATOR_E2E_URL.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… responses Seeding and unsigned forwarded requests now sign for aws.region, and buckets outside us-east-1 are created with a location constraint. Queue URLs on the backend's host, ListDeadLetterSourceQueues results, S3 POST <Location> bodies, and redirects keep pointing at the emulator. Compressed SQS responses pass through unchanged.
lahfir
reviewed
Nov 15, 2026
lahfir
left a comment
Contributor
There was a problem hiding this comment.
looks good to me. a few small things:
lahfir
approved these changes
Nov 15, 2026
A rejected seed stayed in the seeded WeakMap, so a reset reused the rejected promise and every later request failed until restart. Only successful seeds are kept now.
`new URL("localhost:4566")` parses with `localhost:` as the protocol, so a scheme-less backend URL passed validation and every request then failed with 502.
A bad s3.buckets[].region was reported as aws.region, which points at the wrong config key.
The service came only from emulate's path prefixes, so a bucket named kms, sqs, iam, or sts was forwarded to that service. The signed service now takes precedence and the path prefix is stripped only when it matches.
S3, IAM, and STS clients only parse XML errors, so a JSON 502 surfaced as an XML parse error and lost the message. Those services get awsErrorXml-style XML now, while SQS and KMS keep JSON.
Bare `emulate` in zsh runs the shell builtin, not the CLI.
Every describe in the cognito SDK suite is skipIf(externalTarget), so vitest never runs these hooks against an external endpoint.
ctate
approved these changes
Nov 15, 2026
A rejected seed promise stayed cached on the instance, so forwarded requests kept answering 502 after the backend came up and only a reset recovered. The seed attempt now lives in the per-store state, drops itself when it fails, and the proxy starts a new attempt; a successful seed still survives resets.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The AWS emulator covers S3, SQS, IAM, STS, KMS, and Cognito by hand. Projects that need broader AWS coverage have no way to use it without leaving emulate's config, ports, and Cognito flows behind.
Changes
aws.backend.urlforwards S3, SQS, IAM, STS, and KMS to an AWS-compatible endpoint, such as AWS Emulator started with--auth off. Clients keep the emulator's port and/sqs,/iam,/sts,/kms,/s3prefixes. Cognito, the inspector, and/_emulatestay local.Authorizationheader get one naming the target service, because the backend picks the service from the credential scope. Presigned requests are left alone.QueueUrlfields and backend redirects point back at the emulator. Bodies, including encoded ones, pass through byte for byte.account_idand KMSkey_idfail at startup withbackend, since the backend assigns them.AWS_EMULATOR_E2E_URL(plusAWS_EMULATOR_E2E_LAYOUT=rootfor a single-endpoint backend). STS and Cognito suites skip there because they cover emulate-specific behavior.Visual proof
Same config and script against AWS Emulator on
127.0.0.1:9297: an object uploaded throughlocalhost:4007lands on the backend.Before (main ignores
aws.backend):After: