amazon-archives / aws-serverless-auth-reference-app

Serverless reference app and backend API, showcasing authentication and authorization patterns using Amazon Cognito, Amazon API Gateway, AWS Lambda, and AWS IAM.
Other
754 stars 193 forks source link

Changing config.js to set region resulted in mixed-region deployment #3

Closed Kirkaiya closed 7 years ago

Kirkaiya commented 7 years ago

First off, great job on this guys, a really useful sample.

When I did this last week, I edited the config.js to change AWS_REGION to us-west-2 (the optional step). This resulted in the API Gateway stuff and Cognito user pools deploying to us-west-2, but the lambda functions and Dynamo tables all deployed to us-east-1 (despite my local .aws/config file profile also having us-west-2).

It looks like data.js (in api/lambda/ folder) has the region hard-coded to us-east-1, which makes the Lambda and DynamoDB go there. Should there be a step in the instructions to edit data.js (along with the optional step to change config.js) ?

justonian commented 7 years ago

Good catch, Kirk. I will look into this and aim to resolve in the next few days.

Thanks,

Justin

ophilippsen commented 7 years ago

Hi Justin, i prepared a pull request fixing the problem. As far i found a manual config overwrite was left in the dynamodb handler in you lambda functions. Removing it fixes the problem in my test environments.

justonian commented 7 years ago

Thanks, Oliver.

I merged your pull request and verified that Lambda now reads its region for DynamoDB connectivity from the container's environment variable, pointing to the correct region.

Thank you for contributing this pull request!