Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

AWS Amplify Gen1 V6 is unable to resume file upload #14149

Closed
3 tasks done
happypgh opened this issue Jan 20, 2025 · 11 comments
Closed
3 tasks done

AWS Amplify Gen1 V6 is unable to resume file upload #14149

happypgh opened this issue Jan 20, 2025 · 11 comments
Assignees
Labels
bug Something isn't working Storage Related to Storage components/category

Comments

@happypgh
Copy link

happypgh commented Jan 20, 2025

Before opening, please confirm:

JavaScript Framework

React

Amplify APIs

Storage

Amplify Version

v6

Amplify Categories

storage

Backend

None

Environment information

# Put output below this line
System:
    OS: macOS 15.2
    CPU: (10) arm64 Apple M1 Pro
    Memory: 234.09 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.2 - /usr/local/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.9.0 - /usr/local/bin/npm
  Browsers:
    Brave Browser: 130.1.71.121
    Chrome: 131.0.6778.265
    Edge: 131.0.2903.147
    Safari: 18.2
  npmGlobalPackages:
    corepack: 0.25.2
    npm: 10.9.0



Describe the bug

I have just upgraded my AWS Amplify Gen1 V5 to V6 and noticed resumable upload does not seem to be able to continue uploading a file that was unexpectedly stopped before when I call uploadData for the exact same file again.

My understanding is the library keeps track of upload progress as __uploadInProgress dictionary in local storage.

Looking at the source code, it looks like getUploadsCacheKey() is the one that builds the dictionary key and it requires optionsHash to construct the key.

The problem is optionsHash calculated by calculateContentCRC32() is different every time I call uploadData for the same file.

This is what I call

Image

and this is what's remaining in the local storage after attempting to upload and refresh the browser 3 times for the exact same file source and as you can see, the optionsHash part is different for every entry.

Image

Expected behavior

The browser is able to resume unexpectedly stopped uploads

Reproduction steps

  1. Upload a file using uploadData() and stop it in the middle by refreshing the browser
  2. Pick and upload the same file
  3. Confirm a new entry is created in __uploadInProgress

Code Snippet

// Put your code below this line.
const uploadOperation = uploadData({
                path: s3ObjectKey,
                data: file,
                options: {
                    onProgress: (progress) =>
                        onProgressUpdate(file.name, progress)
                }
            });

            receiveUploadTaskHandle && receiveUploadTaskHandle(uploadOperation);

            const { path } = await uploadOperation.result;
            return path;

Log output

// Put your logs below this line


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

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending a response from the Amplify team. labels Jan 20, 2025
@cwomack cwomack self-assigned this Jan 20, 2025
@cwomack cwomack added the Storage Related to Storage components/category label Jan 20, 2025
@jjarvisp
Copy link
Member

Hey @happypgh, thanks for creating this issue, we will review this internally and follow up.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Jan 20, 2025
@cwomack
Copy link
Member

cwomack commented Jan 21, 2025

@happypgh, we can reproduce this on our side and will investigate this as a bug at this time. Thank you for opening this, and we'll follow up with any updates as we have them.

@cwomack cwomack added bug Something isn't working and removed pending-triage Issue is pending triage labels Jan 21, 2025
@cwomack cwomack removed their assignment Jan 21, 2025
@happypgh
Copy link
Author

@cwomack thanks!

@github-actions github-actions bot added the pending-maintainer-response Issue is pending a response from the Amplify team. label Jan 21, 2025
@AllanZhengYP AllanZhengYP self-assigned this Jan 22, 2025
@cwomack cwomack removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Jan 22, 2025
@happypgh
Copy link
Author

Hi @cwomack, it looks like the issue has already been fixed and approved. Would you be able to provide any ETA for the release?

@github-actions github-actions bot added the pending-maintainer-response Issue is pending a response from the Amplify team. label Jan 23, 2025
@AllanZhengYP
Copy link
Member

Hi @happypgh,

The fix will be released in the next release. Although we normally don't provide ETAs, but it will be available soon.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Jan 23, 2025
@happypgh
Copy link
Author

@AllanZhengYP ,

Got it. Thank you so much for fixing it quickly! 👍

@github-actions github-actions bot added the pending-maintainer-response Issue is pending a response from the Amplify team. label Jan 23, 2025
@AllanZhengYP AllanZhengYP removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Jan 23, 2025
@Samaritan1011001
Copy link
Member

@happypgh Release just went out. Please reinstall your node_modules to pull in the latest tag (v6.12.2) and verify it fixes the issue.

@happypgh
Copy link
Author

Thank you thank you !!! You guys are awesome!

@github-actions github-actions bot added the pending-maintainer-response Issue is pending a response from the Amplify team. label Jan 25, 2025
@happypgh
Copy link
Author

@Samaritan1011001 I've just confirmed the issue has been resolved with 6.12.2

Much appreciated 🙏

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Jan 25, 2025
@happypgh
Copy link
Author

happypgh commented Jan 25, 2025

By the way, __uploadInProgress looks like below when I upload multiple different files now. Shouldn't the optionsHash part be unique per file ?

Image

Guess it doesn't matter much as there are enough other parts to make each file key unique.

@github-actions github-actions bot added the pending-maintainer-response Issue is pending a response from the Amplify team. label Jan 25, 2025
@AllanZhengYP
Copy link
Member

@happypgh

That's right. As long as the options being set on each file upload are the same, in this case is empty, the options hash are the same.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Jan 30, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working Storage Related to Storage components/category
Projects
None yet
Development

No branches or pull requests

5 participants