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

fix(storage): omit unserializable properties when hash uploadDataOptions #14151

Merged
merged 6 commits into from
Jan 23, 2025

Conversation

AllanZhengYP
Copy link
Member

@AllanZhengYP AllanZhengYP commented Jan 21, 2025

Description of changes

From #13931, we added a internally-injected option resumableUploadsCache for public uploadData API. However, the default value of this option KeyValueStorage has a reference to the LocalStorage instance.

This causes that the hash value of uploadData options keeps changing, as the LocalStorage value keep changing. This fix adds a list of options that should NOT be hashed when calculating the options hash. Any new options will be added options hash by default.

Issue #, if available

#14149

Description of how you validated changes

Unit test; Manual integ test

Checklist

  • PR description included
  • yarn test passes
  • Unit Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

Checklist for repo maintainers

  • Verify E2E tests for existing workflows are working as expected or add E2E tests for newly added workflows
  • New source file paths included in this PR have been added to CODEOWNERS, if appropriate

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@AllanZhengYP AllanZhengYP marked this pull request as ready for review January 21, 2025 23:41
ashika112
ashika112 previously approved these changes Jan 22, 2025
Copy link
Member

@ashika112 ashika112 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@jjarvisp jjarvisp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is determining if something is serializable or not sufficient to resolve the underlying issue moving forward? It seems to me like the problem was created by something that was serializable and just shouldn't have been included in the calculation of the options hash.

resumableUploadsCache?: KeyValueStorageInterface;
} = {},
): string => {
const unserializableOptionProperties: string[] = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets leave a comment maybe to update this as needed

@AllanZhengYP AllanZhengYP merged commit caf577d into aws-amplify:main Jan 23, 2025
30 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants