1
votes

When calling lambda fuction to upload video with size 3MB, It works fine. But when calling lambda function to upload video which size greater than 7MB, I got error 502 bad gateway with message:"Internal server error" and:

  • content-length →36
  • content-type →application/json date →Tue, 09 May 2017 14:50:47 GMT
  • status →502
  • via →1.1 7a85b832328dd1601b1abdd4f06ee281.cloudfront.net (CloudFront)
  • x-amz-cf-id →0aY02rUX-0WJDjR2tLInShdHxrUMX3ncFv42C60udOPSaW7b5rdbNw==

  • x-amzn-requestid →e310d705-34c6-11e7-8f97-abf7320514e7

  • x-cache →Error from cloudfront

My payload is : { "fileName":"test.mp4", "data":"data:video/mp4;base64,AAAAHGZ0eXBkYXNoAAAA.........." (content of video format base64) }

So please help me why I got this error and how/where config to pass this issue. Thanks.

2
Is there anything in the Lambda logs? - stdunbar
@stdunbar nothing else in cloudwatch :( . I think the lambda function not accept request with large body. Is it right? - tai khoan thu 1
Why would you pass a video content in the request? - johni
@johni: I use lambda as a back-end. the front-end allows user choose file and send request included file content (base64) to back-end. back-end use this information to upload file to s3 and write filename, description... to dynamodb. That is my workflow, but, could you suggest another way base on my workflow to do that? - tai khoan thu 1
Yes. You should have a lambda that generates "pre-signed" URL (google that term) with upload permissions - used by the client side to upload the video to a bucket of yours. You could add the description to the s3 object metadata. Then set a trigger (for new s3 objects event) to a new lambda that will update the dynamoDb table of yours (automatically). - johni

2 Answers

4
votes

There is a request size limit of 6MB for Lambda calls.

AWS Lambda Limits

1
votes

I wanna thank to all of you, specical Johni and Jens Walter. Finally, I resolved my issue base on your suggestion. "You should have a lambda that generates "pre-signed" URL (google that term) with upload permissions - used by the client side to upload the video to a bucket of yours. You could add the description to the s3 object metadata. Then set a trigger (for new s3 objects event) to a new lambda that will update the dynamoDb table of yours (automatically)." <----perfect!. Thanks so much.