fix: correct institiation of S3Client#296
Open
kevin-sucasa wants to merge 1 commit intolocalstack:masterfrom
Open
fix: correct institiation of S3Client#296kevin-sucasa wants to merge 1 commit intolocalstack:masterfrom
kevin-sucasa wants to merge 1 commit intolocalstack:masterfrom
Conversation
28528e4 to
d7d075a
Compare
d7d075a to
0598e95
Compare
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.
I ran into this issue and am currently doing a patch in my rpeo.
Just thought you guys might also want this fix as well. Happy to address any problems!
Problem
The
patchCustomResourceLambdaS3ForcePathStylemethod fails to injectforcePathStyle: trueinto the Serverless Framework's custom-resources Lambda. This causesCustom::S3CloudFormation resourcesto fail during LocalStack deployments with:
getaddrinfo ENOTFOUND .
The root cause is a mismatch between the string pattern the plugin searches for and the actual code in
s3/lib/bucket.jsinsidecustom-resources.zip:S3Client({ maxAttempts: MAX_AWS_REQUEST_TRY });new S3Client({ maxAttempts: MAX_AWS_REQUEST_TRY })Two differences: missing
newkeyword, and a trailing semicolon that doesn't exist. BecauseString.replace()fails silently when there's no match, the zip is written back unmodified and theS3Client never gets
forcePathStyle: true.Impact
Without
forcePathStyle, the AWS SDK uses virtual-hosted-style S3 addressing (bucket.hostname:port), which requires DNS resolution for each bucket name. Inside Docker/LocalStack, these hostnamesdon't resolve — causing all
Custom::S3resources (e.g. S3 event notifications) to fail during stack creation.Fix
Updated the search and replacement strings to match the actual S3Client instantiation code, including the
newkeyword and removing the incorrect semicolon.