api-cors-lambda-crud-dynamodb POST timeout
See original GitHub issue🐛 Bug Report
What is the problem?
I believe this could also fall into Guidance
.
Specifically for: typescript
/api-cors-lambda-crud-dynamodb
example code, after building and deploying the stack. If you try to run the POST
request you get a timeout (3 seconds).
This is done using an example body such as:
{
"body":{
"temp": "hello!!"
}
}
-
All other methods in this example code seem to work exactly as expected, except for
create
. -
If I run this locally and call the
create.js
from my machine, inserting into dynamodb seems to work fine. So the code isn’t the issue since the ENV variables are correct. -
This lead me to believe that perhaps this has something to do with permissions on the create lambda? Since there is a timeout, which I believe occurs on the connection to the dynamodb table on line 23:
await db.put(params).promise();
since no error is ever outputted and just a timeout. -
I checked the cloudformation output, but they all seem to be correct:
-
Correct ServiceRole: “lambda.amazonaws.com”
-
Correct Policies for DynamoDb attached to said service role
-
-
All attached to the lambda in question
Reproduction Steps
- cd into
typescript/api-cors-lambda-crud-dynamodb/
- npm install
- cdk deploy
- Go to Apigateway and in POST /items place this body
{
"body":{
"temp": "hello!!"
}
}
Verbose Log
- Response:
Environment
- **CDK CLI Version: 1.16.2 **
- **Example: api-cors-lambda-crud-dynamodb **
- **Example Version: **
- **OS: Windows **
- **Language: Typescript **
Exact same environment as the example code
Other information
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (1 by maintainers)
I think the problem is that there is no
uuid
library inpackage.json
and on top of thatnode_modules
does not get uploaded to the lambda.does every POST fail, or just the first?