I'm trying to upload image to S3 bucket, but i'm getting this error.
"Code: MethodNotAllowed",
"Message: The specified method is not allowed against this resource.",
"Method: PUT",
"ResourceType: OBJECT",
my route is POST, i need post route to get request for file, i tryed to changed it to PUT but i'm getting same error.
ENV info
S3_KEY=*********
S3_SECRET=********
S3_BUCKET=my-bucket-name
S3_REGION=eu-central-1
S3_ENDPOINT=http://s3-website.eu-central-1.amazonaws.com
uploading function
const fileBuffer = await sharp(payload.image.tmpPath)
.resize({ height: 1400, width: 800, fit: 'inside' })
.toBuffer()
const s3 = Drive.use('s3')
const result = await s3.put(payload.image.tmpPath!, fileBuffer)
What i'm doing wrong?
If you want to perform Amazon S3 operations using JavaScript, then use the offical AWS SDK for JavaScript V3 . You can find this AMazon S3 code example in the official AWS Code Lib here:
https://docs.aws.amazon.com/code-library/latest/ug/javascript_3_s3_code_examples.html
Look at the example under Upload an object to a bucket .
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.