javascript – How can I upload csv file to S3 by containing ‘/’ url by aws-sdk/lib-storage.?
Only the bucket name, not the complete S3 URL, should be provided when specifying the Bucket property of the params objects in the Amazon SDK.
Try changing your code such that the Bucket property only contains the bucket name:
const parallelUploads3 = new Upload({
client: new S3Client({
region: 'us-east-1',
credentials
}),
params: {
Bucket: 'aaa', // specify only the bucket name
Key: file.name,
Body: file
},
leavePartsOnError: false
})
This should prevent the InvalidBucketName issue from occurring when you upload the file to the designated bucket.
Read more here: Source link