amplify-category-api icon indicating copy to clipboard operation
amplify-category-api copied to clipboard

Appsync filter subscriptions does not work!!!

Open juri-diener opened this issue 1 year ago • 7 comments

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.

Screenshot 2024-05-01 at 15 55 59 Screenshot 2024-05-01 at 15 54 53

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.

juri-diener avatar May 01 '24 14:05 juri-diener

Hey,👋 thanks for raising this! I'm going to transfer this over to our API repository for better assistance 🙂.

ykethan avatar May 01 '24 20:05 ykethan

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...

juri-diener avatar May 02 '24 17:05 juri-diener

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.

juri-diener avatar May 02 '24 18:05 juri-diener

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.

juri-diener avatar May 02 '24 19:05 juri-diener

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 avatar May 03 '24 13:05 AnilMaktala

@AnilMaktala Yes, they have the same OrgID.

juri-diener avatar May 09 '24 08:05 juri-diener

I encounter a different issue. So I did a subscription on a different model. Like that: Screenshot 2024-05-09 at 10 28 11

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: Screenshot 2024-05-09 at 10 32 24

The only difference is, that on the Ask I use an index. I hope I could explain what the issue is.

juri-diener avatar May 09 '24 08:05 juri-diener

Hey @juri-diener, Apologies for the delayed response. Are you still encountering this issue?

AnilMaktala avatar Oct 04 '24 18:10 AnilMaktala