简体   繁体   中英

aws-sdk not deploying image to s3 bucket

I am using AWS Lambda to resize images in node.js by using aws-sdk and sharp

Issue I face is that it read file successfully and also apply resize operations but not put object after resize.

Even not giving any error also. I check cloud watch where everything is alright but image not place in resize folder.

It only create key folders but image not there

return Promise.all(_croppedFiles.map(_cropFile => {
            return  S3.putObject({
                Body: _cropFile.buffer,
                Bucket: dstBucket,
                ContentType: _cropFile.config.contentType,
                Key: dstKey
            }).promise()                        
        }))

There is actually no extension in the keyname, which makes it to be just a name and treated as a folder. provide your keyname as dstKey.jpeg or whatever extension you want , and set your content type to image/jpeg

No matter what's the format of your input image , the output image will always be stored in "jpeg" format

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM