My lambda must deployed to cn-northwest-1 in china. But it is always us-east-1?
Issue Summary
My lambda must deployed to cn-northwest-1 in china. But it is always us-east-1. aws key and secret in china can not apply to us-east-1 region: InvalidClientTokenId: The security token included in the request is invalid.
Actual behavior
lambda deployed to us-east-1
Expected behavior
lambda deployed to cn-northwest-1
Steps to reproduce
# serverless.yml
myNextApplication:
component: "./node_modules/@sls-next/serverless-component" # it is recommended you pin the latest stable version of serverless-next.js
inputs:
name:
defaultLambda: nextjsTestDefaultLambda
apiLambda: nextjsTestApiLambda
imageLambda: nextjsTestImageLambda
domain: ["test", "steedos.cn"]
stage: dev
deploy: true
bucketRegion: cn-northwest-1
region: cn-northwest-1
runtime: nodejs14.x
memory: 2048
timeout: 30
enableS3Acceleration: false
Screenshots/Code/Configuration/Logs
DEBUG ─ Starting deployment of lambda nextjsTestApiLambda to the us-east-1 region.
DEBUG ─ Syncing role v6excn-4asies in region us-east-1.
error:
InvalidClientTokenId: The security token included in the request is invalid.
Versions
- OS/Environment: Mac
- @sls-next/serverless-component version: 3.3
- Next.js version: 11.1.2
Additional context
Checklist
- [x] You have reviewed the README and FAQs, which answers several common questions.
- [x] You have reviewed our DEBUGGING wiki and have tried your best to include complete information and reproduction steps (including your configuration) as is possible.
- [x] You have first tried using the most recent
latestoralpha@sls-next/serverless-componentrelease version, which may have already fixed your issue or implemented the feature you are trying to use. Note that the oldserverless-next.jscomponent and theserverless-next.jsplugin are deprecated and no longer maintained.
Please see here: https://github.com/serverless-nextjs/serverless-next.js#my-lambda-is-deployed-to-us-east-1-how-can-i-deploy-it-to-another-region
Currently this only supports Lambda@Edge which is deployed globally in all regions where CloudFront is available: https://aws.amazon.com/cloudfront/features/?whats-new-cloudfront. For China it looks like there are two regions. The base Lambda is created in us-east-1 (per AWS, it has to) but actually it's replicated across all CF regions.
Lambda is not yet available with the component, although there is draft PR here https://github.com/serverless-nextjs/serverless-next.js/pull/1144 but as this is a community project, no ETA on it yet.
AWS has two completely independent services around the world:
- China: https://www.amazonaws.cn/
- Global: https://aws.amazon.com/
The difference is not only in region. They have independent user account and password, and also independent AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
Services deployed to nodes outside of China have very unstable access speeds in China and are always blocked.
I want to deploy my service to lambda in china: https://www.amazonaws.cn/en/lambda/?nc1=h_ls , thanks
Ya, that makes sense, as I don't have experience deploying for China I'm not sure the differences in CloudFront. It seems Lambda@Edge is not supported in China CloudFront for now but maybe that has changed? https://docs.amazonaws.cn/en_us/aws/latest/userguide/cloudfront.html.
Unfortunately but we are only supporting Lambda@Edge for now as mentioned until the above PR is completed: https://github.com/serverless-nextjs/serverless-next.js/pull/1144.
Ya, that makes sense, as I don't have experience deploying for China I'm not sure the differences in CloudFront. It seems Lambda@Edge is not supported in China CloudFront for now but maybe that has changed? https://docs.amazonaws.cn/en_us/aws/latest/userguide/cloudfront.html.
Unfortunately but we are only supporting Lambda@Edge for now as mentioned until the above PR is completed: #1144.
Since https://github.com/serverless-nextjs/serverless-next.js/pull/1144 is completed, is there any update for this issue?