简体   繁体   English

如何使用nodejs使用无服务器框架使用lambda函数将图像/文件上传到s3存储桶?

[英]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.

相关问题 如何使用nodejs将图像上传到s3存储桶? - How to upload the images to s3 bucket using nodejs? 如何使用 Lambda 函数将下载的文件上传到 s3 存储桶 - How to upload downloaded file to s3 bucket using Lambda function 如何使用无服务器框架在 AWS Lambda 函数上添加 S3 触发事件? - How to add S3 trigger event on AWS Lambda function using Serverless framework? 如何使用 NodeJS 在 S3 存储桶上上传 CSV 文件? - How to Upload CSV file on S3 Bucket using NodeJS? 如何使用带有Lambda函数的Node.js在AWS S3存储桶中创建嵌套文件夹? - How to create nested folders in aws s3 bucket using nodejs with lambda function? 如何使用Java在AWS Lambda函数中创建S3存储桶 - How to create S3 bucket in AWS lambda function using Java 使用无服务器框架处理带有 lambda 的 S3 'miss' - Handle an S3 'miss' with a lambda using serverless framework 在AWS中如何使用lambda函数将文件从一个s3存储桶复制到另一个s3存储桶 - In AWS how to Copy file from one s3 bucket to another s3 bucket using lambda function 使用 API 网关将大型文件上传/下载到 Lambda function 而不使用任何 S3 存储桶 - Upload/Download LARGE files to/from Lambda function using API Gateway without making any use of S3 Bucket 如何使用无服务器框架向现有 s3 存储桶添加新的生命周期规则 - How to add a new lifecycle rule to existing s3 bucket using serverless framework
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM