amplify-category-api
amplify-category-api copied to clipboard
Appsync filter subscriptions does not work!!!
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v21.7.3
Amplify CLI Version
11.0.5
What operating system are you using?
Mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No
Describe the bug
If I run the subscription with the filter. I don't receive the item. If I remove on the subscription the filter, I get the object if an Ask is created.
Expected behavior
Should work when filtering on subscription.
Reproduction steps
Like the image above.
Project Identifier
No response
Log output
# Put your logs below this line
Additional information
No response
Before submitting, please confirm:
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
Hey,👋 thanks for raising this! I'm going to transfer this over to our API repository for better assistance 🙂.
Hey thanks, for transferring. Please help I don't know if I'm doing something wrong, or it is a bug? I'm now stuck in my project because of this...
So I followed this video with no filters and even this is not working. https://www.youtube.com/watch?v=CeeoFqE2OU0
subscription MySubscription { onCreateAskByOrgId(orgID: "162553ea-aead-47bd-9977-25214d2334871") { id } } mutation MyMutation { createAsk(input: {userID: "85535378-ca9b-4930-931c-291dgdgdd09f4", orgID: "162553ea-aead-47bd-9977-25214d2334871", msg: "Test"}) { id orgID } }
This is my model: type Ask @model @auth( rules: [ { allow: private, operations: [read] } { allow: owner, ownerField: "owner" } { allow: groups, groups: ["Admins"] } ] ) { id: ID! userID: ID! @index(name: "askByUser") orgID: ID! @index(name: "askByOrg") owner: ID @auth(rules: [{ allow: owner, operations: [read, create] }]) msg: String audio: String private: Boolean @default(value: "false") user: User @belongsTo(fields: ["userID"]) resp: [Resp] @hasMany(indexName: "respByAsk", fields: ["id"]) replied: Int }
Please prioritize this issue.
Okay the issue is, when I logged in, in both tabs with the same user_pool user then it works. But if I do it with different one. So that one user create the ask and the another user listen to that, it does not work. Is this the right behaviour in AppSync? Because in my App it should work. That if any user is creating an ask and some user listener to that, should get notified.
Hi @juri-diener, Thank you for the additional details. I have a follow-up question: I notice that your subscription filter using a single OrgID. Are both users from the same organization?
@AnilMaktala Yes, they have the same OrgID.
I encounter a different issue. So I did a subscription on a different model.
Like that:
I could just give the orgID on the onCreateFollowOrg. But why I don't have the option to provide an orgID for the onCreateAsk?
This are my models:
The only difference is, that on the Ask I use an index. I hope I could explain what the issue is.
Hey @juri-diener, Apologies for the delayed response. Are you still encountering this issue?