对于较大的文件,Lambda S3 Put 函数不会触发 [英] Lambda S3 Put function not triggering for larger files

查看:24
本文介绍了对于较大的文件,Lambda S3 Put 函数不会触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在探索将电子邮件的附件与 .eml 文件本身分开存储.我有一个 SES 规则集,可以将入站电子邮件传送到存储桶.当存储桶检索电子邮件时,S3 Put Lambda 函数会解析原始电子邮件(MIME 格式),base64 解码附件缓冲区,并对每个附件和原始 .eml 文件执行 putObject 到新存储桶.

I am currently exploring storing the attachments of an email separately from the .eml file itself. I have an SES rule set that delivers an inbound email to a bucket. When the bucket retrieves the email, an S3 Put Lambda function parses the raw email (MIME format), base64 decodes the attachment buffers, and does a putObject for each attachment and the original .eml file to a new bucket.

我的问题是,此 Lambda 函数不会为附件超过 ~3-4 MB 的电子邮件触发.邮件被接收并存储在初始存储桶中,但该函数在接收时不会触发.此外,该事件不会出现在 CloudWatch 中.但是,在使用硬编码的 S3 Put 负载手动测试时,以及手动将 .eml 文件上传到分配的存储桶时,该函数工作得非常好.

My problem is that this Lambda function does not trigger for emails with attachments exceeding ~3-4 MB. The email is received and stored in the initial bucket, but the function does not trigger when it is received. Also, the event does not appear in CloudWatch. However, the function works perfectly fine when manually testing it with a hardcoded S3 Put payload, and also when manually uploading a .eml file to the assigned bucket.

你知道为什么会有这个限制吗?也许这是存储桶的权限问题,或者可能是分配的 Lambda 角色的问题?在手动测试时,我发现这绝不是超时或超过最大内存使用的问题.

Do you have any idea why there is this limitation? Perhaps this is a permission issue with the bucket or maybe an issue with the assigned Lambda role? When manually testing I’ve found this is by no means a timeout or exceeding max memory used issue.

推荐答案

较大的文件几乎肯定会通过 S3 分段上传而不是常规的 Put 操作上传.您需要将 Lambda 订阅配置为也收到分段上传的通知.听起来该函数目前只订阅了 s3:ObjectCreated:Put 事件,您需要将 s3:ObjectCreated:CompleteMultipartUpload 添加到配置中.

The larger files are almost certainly being uploaded via S3 Multipart Upload instead of a regular Put operation. You need to configure your Lambda subscription to also be notified of Multipart uploads. It sounds like the function is only subscribed to s3:ObjectCreated:Put events currently, and you need to add s3:ObjectCreated:CompleteMultipartUpload to the configuration.

这篇关于对于较大的文件,Lambda S3 Put 函数不会触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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