serverless: Receive "Deployment bucket is not in the same region as the lambda function" when using us-east-1
This is a Bug Report
Description
- What went wrong?
When attempting to use a pre-existing S3 bucket in us-east-1 via the deploymentBucket configuration option, I receive an error response “Deployment bucket is not in the same region as the lambda function”.
Debugging through the Serverless code, I observed that it is attempting to match a LocationConstraint returned from the AWS SDK to the region; however, AWS Documentation states:
When the bucket’s region is US East (N. Virginia), Amazon S3 returns an empty string for the bucket’s region
Due to this, it appears the check in configureStack.js to match the bucket’s region with the specified region fails and I receive the error message.
- What did you expect should have happened?
I should have been able to use the pre-existing bucket.
- What was the config you used?
...
provider:
name: aws
runtime: nodejs4.3
stage: dev
region: us-east-1
deploymentBucket: my-bucket-name
...
- What stacktrace or error message from your provider did you see?
Deployment bucket is not in the same region as the lambda function
Additional Data
- _Serverless Framework Version you’re using_: 1.0.2
- _Operating System_: OSX
- _Stack Trace_:
- _Provider Error messages_:
Serverless Error ---------------------------------------
Deployment bucket is not in the same region as the lambda
function.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (5 by maintainers)
Commits related to this issue
- fix #2404 by handling EU special case response for LocationConstraint — committed to ssemyonov/serverless by deleted user 7 years ago
- add tests for #2404 covering inconsistent AWS API responses — committed to ssemyonov/serverless by deleted user 7 years ago
May I know why it is not allowed to use the S3 bucket from different region? Is there any reason for that?
Hi @eahefnawy are you still looking into EU - eu-west-1 issue? Do you need a hand?
BOOM! 💥 That is one nice catch @ssemyonov … I feel like we’re always on a mission to keep up with AWS inconsistencies 😄 … I’m gonna PR a quick fix today.
Thanks for reporting and investigating @briguy202 😊 … I’ve pushed a fix along with this PR and will be merged very soon. It’s a high priority!
Cheers 👼
Having it trying to run
sls devforsa-east-1. No clue on how to solve this.I’ve got the same issue happening when using pre-existing deployment bucket in
eu-west-1region in some of AWS accounts in my company. The reason is AWS returnsLocationConstraintvalue asEUwhich is one of the values foreu-west-1according to AWS docs:This could be one-liner fix in configureStack.js similar to the fix for original issue:
Should I raise a separate issue for this case or current one could be reopened?