I am getting AccessDenied: Access Denied while upload files to my s3 bucket. But everything is working perfectly locally. I also checked the permissions in IAM and I have given s3 full access.
I thought there must be some issue with the env not being fetched properly so I logged everything. All the env are being fetched properly. Why is it only not working in production, I am really confused since it is working locally.
This is the error I am seeing in my cloudwatch :
**AccessDenied: Access Denied**
at throwDefaultError (/app/node_modules/@aws-sdk/client-s3/node_modules/@smithy/smithy-client/dist-cjs/index.js:838:20)
at async /app/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:121:14 {
'$fault': 'client',
'$metadata': {
httpStatusCode: 403,
requestId: 'Y9W345675765774JW',
extendedRequestId: 'LW2UXs3455646hiFZs0b/mU0UNisiXAfsdff43fdsgHOUH8s51OJklhRNU=',
cfId: undefined,
attempts: 1,
totalRetryDelay: 0
},
I have also enabled CORS for :
[
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET",
"POST",
"PUT",
"DELETE",
"HEAD"
],
"AllowedOrigins": [
"*"
],
"ExposeHeaders": []
}
]