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.

Feature Request: Support large event payload input to Lambda

See original GitHub issue

I’m trying to build an API endpoint lambda function that accepts an uploaded binary file.

Try this:

git clone git@github.com:awslabs/aws-sam-local.git
cd aws-sam-local/samples/api-event-source
sam local start-api

and then in a new shell, from the aws-sam-local folder:

curl --request POST --url 'http://localhost:3000/' --data-binary '@./sam-banner.png'

The response I get to curl is { "message": "Internal server error" }.

Back in the first shell, I see this output:

2017/11/01 23:05:55 Connected to Docker 1.32
2017/11/01 23:05:55 Fetching lambci/lambda:nodejs6.10 image for nodejs6.10 runtime...
nodejs6.10: Pulling from lambci/lambda
Digest: sha256:7eb4ced6a15ae3c30effc4ec0cd3aabb2bd57c9a8330b37920c3d5d722d81083
Status: Image is up to date for lambci/lambda:nodejs6.10

Mounting index.handler (nodejs6.10) at http://127.0.0.1:3000/ [OPTIONS GET HEAD POST PUT DELETE TRACE CONNECT]
Mounting static files from public at /

You can now browse to the above endpoints to invoke your functions.
You do not need to restart/reload SAM CLI while working on your functions,
changes will be reflected instantly/automatically. You only need to restart
SAM CLI if you update your AWS SAM template.

2017/11/01 23:06:19 Invoking index.handler (nodejs6.10)
standard_init_linux.go:185: exec user process caused "argument list too long"
2017/11/01 23:06:25 Function index.handler timed out after 3 seconds
2017/11/01 23:06:25 Error invoking nodejs6.10 runtime: io: read/write on closed pipe

If I remove the --data-binary, to send a POST request without a body, I get the expected OK response.

If I change --data-binary '@./sam-banner.png' to --data-binary '@./README.md', replacing the 129 KB file with a 21 KB one, I also get the OK response. So I gather that there must be some (fairly low) limit on request size? Is there some way I can increase it?

Also, I feel like aws-sam-local should print an informative error message, rather than (I presume) passing invalid parameters onward to Docker for it to throw an exception on.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:14
  • Comments:31 (8 by maintainers)

github_iconTop GitHub Comments

15reactions
Dhwanil-Patelcommented, Mar 16, 2020

Is there any update? Or some intermediate solution?

8reactions
aahungcommented, Jan 30, 2021

v1.16.0 is released, please reopen if the issue still persists

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting payloads - AWS Lambda
Create tests to ensure that your function handles larger payload sizes. The maximum size for a Lambda event payload is 256 KB. Depending...
Read more >
Bountysource
Feature Request : Support large event payload input to Lambda.
Read more >
Deep Dive: Lambda's Request Payload Size Limit (2/2)
The Lambda quotas page lists both the request and response payload limits as same 6 MB for synchronous invocations. In the previous post...
Read more >
lambda_runtime - crates.io: Rust Package Registry
This project does not currently include Lambda event struct definitions. Instead, the community-maintained aws_lambda_events crate can be ...
Read more >
Create a Calc REST API with two Amazon service integrations ...
Lambda Function integration is a special case of the Amazon Service integration ... the Lambda function, supplying the input in the method request...
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