question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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” image

    • Correct Policies for DynamoDb attached to said service role image

  • All attached to the lambda in question image

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: image

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:closed
  • Created 4 years ago
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
elderapocommented, Jan 23, 2020

I think the problem is that there is no uuid library in package.json and on top of that node_modules does not get uploaded to the lambda.

1reaction
rhboydcommented, Nov 29, 2019

does every POST fail, or just the first?

On Nov 29, 2019, at 10:50 AM, DavidQN notifications@github.com wrote:

🐛 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

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using AWS Lambda with Amazon DynamoDB
If processing succeeds, Lambda resumes polling until it receives more records. By default, Lambda invokes your function as soon as records are available....
Read more >
AWS Recipe: Build an Asynchronous Serverless Task API
In this article, you will learn how to build an asynchronous serverless task API from scratch on AWS using Lambda, DynamoDB, API Gateway, ......
Read more >
Building Swift Serverless REST API with AWS Lambda ...
Swift Lambda Runtime to handle API Gateway request event. Swift AWS DynamoDB SDK to ... With this, we'll be able to perform CRUD...
Read more >
Serverless Offline - Serverless Framework: Plugins
This Serverless plugin emulates AWS λ and API Gateway on your local machine to ... authorizers, proxies, timeouts, responseParameters, HTTPS, CORS, etc.
Read more >
Tutorial: Using Lambda with API Gateway - 亚马逊云科技
Your Lambda function will perform create, read, update, and delete (CRUD) operations on a DynamoDB table. This function is provided here for demonstration,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found