问题
I am trying to deploy lambda using the serverless framework in China AWS region - I am getting into below error.
Is there any workaround to pass variables in serverless.yaml?
CloudFormation - UPDATE_ROLLBACK_COMPLETE - AWS::CloudFormation::Stack - aws-china-lambda-Test-Env Serverless: Operation failed! Serverless: View the full error output: https://cn-north-1.console.aws.amazon.com/cloudformation/home?region=cn-north-1#/stack/detail?stackId=arn%3Aaws-cn%3Acloudformation%3Acn-north-1%XXXXX%3Astack%2Faws-china-lambda-Test-Env%2Fc9228230-72e5-11e9-a846-XXXX Serverless
Error ---------------------------------------
An error occurred: QueueAlertLambdaFunction - EnvironmentVariablesFeature is not supported in cn-north-1 region. For more information, please visit the AWS Lambda documentation on Environment Variables. (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: a19ca4e3-XXX-11e9-adef-XXXXX).
回答1:
Update 11/19/2019 It is now supported see AWS Lambda now supports Environment Variables in the AWS China (Beijing) Region, operated by Sinnet, and the AWS China (Ningxia) Region, operated by NWCD
This is indeed a limitation in the China regions (see AWS Lambda):
The AWS services in China implementation of AWS Lambda is unique in the following ways:
The following AWS Lambda features are unavailable in the Beijing and Ningxia Regions:
- Lambda environment variables
One way to solve your problem is to use old serverless plugins that used to offer a solution for environment variables before this feature was available in Lambda, have a look at those:
- serverless-plugin-write-env-vars
- serverless-dotenv-plugin
- serverless-env-generator
来源:https://stackoverflow.com/questions/56080161/lambda-environmentvariablesfeature-is-not-supported-in-cn-north-1-region