silvermine / serverless-plugin-cloudfront-lambda-edge

Adds Lambda@Edge support to Serverless
MIT License
296 stars 41 forks source link

The function must be in region 'us-east-1' #72

Closed nickfan closed 3 years ago

nickfan commented 3 years ago

i installed this plugin and follow the intro,but it only works with default region 'us-east-1' when i set region to other (eg: us-west-2) in serverless.yml

    region: us-west-2

i got this error when i deploy

Serverless Error ----------------------------------------

  An error occurred: GsSeoCdn - Resource handler returned message: "Invalid request provided: The function must be in region 'us-east-1'. ARN: arn:aws:lambda:us-west-2:266825709873:function:sls-gs-cdn-url-dev-gsSeoCdnUrl:2 (Service: CloudFront, Status Code: 400, Request ID: 6fe268a8-e870-4eeb-a900-6ee8fcd7e868, Extended Request ID: null)" (RequestToken: 7c96b370-747f-eaec-c8de-5a5bf76400b5, HandlerErrorCode: InvalidRequest).
jthomerson commented 3 years ago

AWS requires Lambda@Edge functions to be deployed to us-east-1

https://aws.amazon.com/blogs/networking-and-content-delivery/managing-lambdaedge-and-cloudfront-deployments-by-using-a-ci-cd-pipeline/#:~:text=Using%20the%20AWS%20CLI%2C%20change%20the%20region%20in%20the%20configuration%20to%20us-east-1.%20You%20must%20write%20and%20configure%20Lambda%40Edge%20functions%20in%20this%20region.