-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Before opening, please confirm:
- I have searched for duplicate or closed issues and discussions.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
JavaScript Framework
React
Amplify APIs
Storage
Amplify Version
v6
Amplify Categories
storage
Backend
Other
Environment information
aws-amplify latest
Netlify
Everything runs correctly locally and even in the Netlify development website but when it makes it into production it fails. Development can access production S3 just fine but in production no access to production s3 bucket.
Describe the bug
When developing, I can access any S3 bucket either my dev or prod, no issues and correct signed URLs are generated. When I deploy into my Netlify dev. environment, same, not issues it works correctly. When my code is in production on a app.v2. endpoint, it is a subdomain not sure if there's a CORS issue here I tried many S3 bucket permissions changes trying to understand what potential environment differences. I generated production builds and ran them locally as well, these work fine locally but when the code is deployed into production, every call to generate a URL returns something like:
https://prod-rynsemedia.s3.us-west-2.amazonaws.com/public/undefined
even when I hardcode the input path, it returned this "undefined" URL. At first it said s3:ListBucket was not allowed, but it did work from all other environments including directly to this prod-rynsemedia bucket. I added the s3:ListBucket to the prod bucket and then the error for ListBucket disappeared but it still generated the '/undefined' URL and would say 404 object does not exist. I am unable to get either downloadData or getUrl to return correct URL's ONLY in the production environment hosted in Netlify. I've checked all environment variables, these are correct, there is almost no way for me to debug this issue that I can think of but it seems to be an issue within the aws-amplify code that is a silent error or sorts.
Expected behavior
Generate the correct signed URL location, not an "undefined"
Reproduction steps
Only in netlify production environment is an "undefined" URL location returned.
Code Snippet
const downloadResult = await downloadData({
path: `public/metrics/....json` //Even hard coded location will return 'public/undefined'
}).result;Log output
Details
index-DGZZhei7.js:792
GET https://<bucket>.s3.us-west-2.amazonaws.com/public/undefined 404 (Not Found)
(anonymous) @ index-DGZZhei7.js:792
xhrTransferHandler @ index-DGZZhei7.js:792
nu @ index-DGZZhei7.js:455
(anonymous) @ index-DGZZhei7.js:458
await in (anonymous)
(anonymous) @ index-DGZZhei7.js:455
(anonymous) @ index-DGZZhei7.js:455
(anonymous) @ index-DGZZhei7.js:792
await in (anonymous)
(anonymous) @ index-DGZZhei7.js:455
(anonymous) @ index-DGZZhei7.js:455
await in (anonymous)
(anonymous) @ index-DGZZhei7.js:793
await in (anonymous)
(anonymous) @ index-DGZZhei7.js:793
createCancellableTask @ index-DGZZhei7.js:793
downloadData @ index-DGZZhei7.js:793
(anonymous) @ index-DGZZhei7.js:793
(anonymous) @ index-DGZZhei7.js:793
Rj @ index-DGZZhei7.js:43
Ik @ index-DGZZhei7.js:43
Xk @ index-DGZZhei7.js:43
Qk @ index-DGZZhei7.js:43
Fk @ index-DGZZhei7.js:43
jg @ index-DGZZhei7.js:41
(anonymous) @ index-DGZZhei7.js:43Understand this errorAI
index-DGZZhei7.js:793 Error fetching count data: NoSuchKey: The specified key does not exist.
...
aws-exports.js
No response
Manual configuration
Storage: {
S3: {
bucket: import.meta.env.VITE_S3_BUCKET,
region: import.meta.env.VITE_REGION
}
}
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response