Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

DataStore to establish Subscription with server-side filtering #2728

Open
lawmicha opened this issue Mar 7, 2024 · 1 comment
Open

DataStore to establish Subscription with server-side filtering #2728

lawmicha opened this issue Mar 7, 2024 · 1 comment
Labels
datastore DataStore category/plugins feature-request Request a new feature

Comments

@lawmicha
Copy link
Contributor

lawmicha commented Mar 7, 2024

DataStore translates the syncExpression over to the filter predicate on the GrapQL query. When DataStore performs a sync query, the filter is added, to perform server side filtering. When DataStore establishes the subscriptions, the filtering is applied on the client side.Since the subscription filtering feature released in April 2022, customers can provision AppSync with the filter input capability on their subscription operations. DataStore can now leverage this by passing in filter to the subscription request.

  1. We attempt the subscription with the filter and catch ther error
  2. Handle the specific "RTF" error as a retry without the filter for backwards compatibility.

References
https://github.com/aws-amplify/amplify-js/blob/main/packages/datastore/src/sync/processors/subscription.ts#L467-L492

https://github.com/aws-amplify/amplify-js/blob/main/packages/datastore/src/sync/processors/subscription.ts#L677-L682C10

This logic allows for backwards compatibility with AppSync backends without the subscription filter capability.

Originally posted by @lawmicha in aws-amplify/amplify-swift#3550 (comment)

@lawmicha lawmicha changed the title DataStore to perform Subscription Server side filtering DataStore to perform Subscription with server-side filtering Mar 7, 2024
Copy link
Contributor

github-actions bot commented Mar 7, 2024

This issue was opened by a maintainer of this repository; updates will be posted here. If you are also experiencing this issue, please comment here with any relevant information so that we're aware and can prioritize accordingly.

@github-actions github-actions bot added the pending-triage Issue is pending triage label Mar 7, 2024
@lawmicha lawmicha changed the title DataStore to perform Subscription with server-side filtering DataStore to establish Subscription with server-side filtering Mar 7, 2024
@tylerjroach tylerjroach added feature-request Request a new feature datastore DataStore category/plugins and removed pending-triage Issue is pending triage labels Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datastore DataStore category/plugins feature-request Request a new feature
Projects
None yet
Development

No branches or pull requests

2 participants