[英]How to upload images/files to s3 bucket using lambda function using serverless framework using nodejs?
I have requirement to upload images to s3 bucket from lambda function using serverless framework in node js.我需要使用节点 js 中的无服务器框架将图像从 lambda 函数上传到 s3 存储桶。
I want to get image file from react app.我想从反应应用程序中获取图像文件。 So, How can I get image file from react app to lambda ao that I can upload it to s3 bucket using lambda.那么,如何从 react app 获取图像文件到 lambda ao 以便我可以使用 lambda 将其上传到 s3 存储桶。
I have user lambda-multipart-parser to upload.我有用户 lambda-multipart-parser 要上传。 It is working in local environment but not working after deployed to aws.它在本地环境中工作,但在部署到 aws 后无法工作。 lambda-multipart-parser is able to parae request in local but unable to parse request after deployed to aws.lambda-multipart-parser is able to parse complete image in buffer array but afrer deployed, it is unable to parse complete image to image. lambda-multipart-parser 能够在本地解析请求,但部署到 aws 后无法解析请求。lambda-multipart-parser 能够解析缓冲区数组中的完整图像,但在部署后,无法将完整图像解析为图像。 There are missing buffer data after deployed.部署后缓冲区数据丢失。
Suggest me any good solution.建议我任何好的解决方案。
are you sure the lambda parser unable to parse the image?您确定 lambda 解析器无法解析图像吗? if it really isn't able then i would check the logs maybe you need more memory or a bigger timeout ( you can find how to do it here https://www.serverless.com/framework/docs/providers/aws/guide/functions/ ), if you just can't upload it from the lambda to the s3 bucket i would guess that you need to add IAM policies to give the lambda an authorization to upload an image to the s3 ( https://www.serverless.com/framework/docs/providers/aws/guide/iam/ ).如果它真的不能那么我会检查日志也许你需要更多的内存或更大的超时(你可以在这里找到如何做到这一点https://www.serverless.com/framework/docs/providers/aws/guide /functions/ ),如果您无法将其从 lambda 上传到 s3 存储桶,我猜您需要添加 IAM 策略以授权 lambda 将图像上传到 s3( https://www. serverless.com/framework/docs/providers/aws/guide/iam/ )。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.