Not able to upload file
const config = {
bucketName: process.env.BUCKET_NAME,
dirName: `user/${user_id}/checklist/${checklist_id}`,
region: process.env.REGION,
accessKeyId: process.env.ACCESS_KEY_ID,
secretAccessKey: process.env.SECRET_ACCESS_KEY
}
const S3Client = new S3(config);
S3Client
.uploadFile(file)
.then(data => console.log(data))
.catch(err => console.error(err))
gives Error:
POST https://bucketname.s3-us-east-1.amazonaws.com/ net::ERR_NAME_NOT_RESOLVED
react_devtools_backend.js:2273 TypeError: Failed to fetch
Then if I remove region from config and tries to upload file with param 'File' it gives following error
react_devtools_backend.js:2273 TypeError: Cannot read property 'split' of undefined
at aws-s3.js:1
at s../node_modules/aws-s3/dist/aws-s3.js.s.uploadFile (aws-s3.js:1)
This is what File object/ attachment I pass to uploadFile() :

if you can help?
If it is a react app, then name the variable as REACT_APP_VARIABLE_NAME, this solved the problem for me
@zhushangs what variable exactly?
@hiranvikas77 : not sure if you have solved the issue but I found a fix
const config = {
bucketName: process.env.BUCKET_NAME,
dirName: user/${user_id}/checklist/${checklist_id},
region: process.env.REGION,
accessKeyId: process.env.ACCESS_KEY_ID,
secretAccessKey: process.env.SECRET_ACCESS_KEY,
s3Url: 'https://bucketname.s3.amazonaws.com', /* without the suffix zone added */
}