I am getting invalid aws access key id error . The code is below
const s3 = new AWS.S3({
accessKeyId: process.env.AWS_ACCESS_KEY_ID, // your AWS access id
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY, // your AWS access key
});
// actual function for uploading file
async function uploadFile(file) {
const params = {
Bucket: process.env.AWS_BUCKET, // bucket you want to upload to
Key: `fileupload/scanskill-${Date.now()}-${file.name}`, // put all image to fileupload folder with name scanskill-${Date.now()}${file.name}`
Body: file.data,
ACL: "public-read",
};
const data = await s3.upload(params).promise();
return data.Location; // returns the url location
}
The problem is not with the code because i tried nearly half a dozen different tutorials and always the same error . I have the updated credentials in the .env file also on the /.aws/credentials file . However i keep getting the same error . i have looked for solutions online which say create another IAM but i cannot do so as i am using a AWS educate account for my uni project . any solutions will be appreciated.
for it to work but the same error keeps popping up.