AWS Lambda响应错误 [英] Aws Lambda response error

查看:194
本文介绍了AWS Lambda响应错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行aws lambda,它将从maria DB中获取数据,并将获取的行作为JSON对象返回. JSON数组中的项目总数为64K.

I am running aws lambda which will fetch data from maria DB and return the fetched rows as a JSON object. A total number of item in JSON array is 64K.

我收到此错误:

{ "error": "body size is too long" }

是否可以通过对lambda进行任何配置来发送所有64K行?

Is there a way I can send all 64K rows by making any configuration change to lambda?

推荐答案

您无法发送64K行(超出6MB正文有效负载大小

You cannot send the 64K rows (Which goes beyond 6MB body payload size limit) making configuration changes to Lambda. Few alternative options are.

  • Query the data and build a JSON file with all the rows in /tmp (Up to 512MB) directory inside Lambda, upload it to S3 and return a CloudFront Signed URL to access the data.
  • Split the dataset into multiple pages and do multiple queries.
  • Use a EC2 instance or ECS, instead of Lambda.

注意:根据查询数据的目的,其大小等.可以使用不同的机制来有效地使用其他AWS服务.

Note: Based on the purpose of queried data, its size & etc. different mechanisms can be used, efficiently using other AWS services.

这篇关于AWS Lambda响应错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆