Open idanail opened 7 months ago
Hi @idanail thank you for opening this issue. It doesn't look like you have enabled resumable option in your sample code as described in the documentation here - could you try that and let me know if the progress call back works as expected?
@nadetastic I already tried that, also tried with various file sizes (2MB-20MB). On localhost the progress callback works as intended, but not on the hosted environment.
I too am having this issue. Works fine when running the development server (vite dev
) but once pushed to S3/CloudFront the progress callback doesn't fire.
I've, painfully, gone through all versions of aws-amplify
and it seems that the update from 5.3.3 to 5.3.4 is what break it for me.
Hi @brewerdaniel-IW following up here - I can confirm the same behavior with v5 of my app when running a production build, which seems to be the key differentiator and not necessarily the deploy location. Im currently discussing with the team for understand what the root issue is but also wanted to provide an alternatives.
First if you haven't yet, I would strongly suggest migrating from v5 to v6 of the library, as this issue should not be present in v6. You can take a look at the migration documentation here but feel free to ask me any questions you may have.
If migrating is not possible for some reason, you can instead provide the resumable: true
parameter to Storage.put()
which I can confirm will trigger the progressCallback method. However by doing so, the Storage.put() command does not return a promise. Here's an example
Storage.put(`path`, file, {
resumable: true, // Enable this
progressCallback(progress) {
console.log(`uploaded: ${progress.loaded}/${progress.total}`);
},
completeCallback: (event) => {
console.log(`Successfully uploaded ${event}`);
},
errorCallback: (err) => {
console.error("Unexpected error while uploading", err);
},
});
I will follow up again but please let me know if you have any questions in the meantime.
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
Authentication, Storage
Amplify Categories
auth, storage, function, api, hosting
Environment information
Describe the bug
I am experiencing an issue with the Storage.put() method in my Amplify application when deployed to the hosted environment. The file upload itself is successful, but the progress is not displayed progressively as expected, but only when the file uploads successfully. Locally, the progressCallback() is working as intended and progressively displaying the percentage.
Expected behavior
I expect the progressCallback function to be triggered multiple times during the file upload, providing progress information.
Reproduction steps
Deploy the Amplify application to the hosted environment. Trigger a file upload using the Storage.put() method. Observe that the file is successfully uploaded, but the progress is not displayed.
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
No response
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