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

Appsync filter subscriptions does not work!!! #2521

Open
2 tasks done
juri-diener opened this issue May 1, 2024 · 7 comments
Open
2 tasks done

Appsync filter subscriptions does not work!!! #2521

juri-diener opened this issue May 1, 2024 · 7 comments
Labels

Comments

@juri-diener
Copy link

juri-diener commented May 1, 2024

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:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.
@ykethan
Copy link

ykethan commented May 1, 2024

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

@ykethan ykethan transferred this issue from aws-amplify/amplify-cli May 1, 2024
@juri-diener
Copy link
Author

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
Copy link
Author

juri-diener commented May 2, 2024

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
Copy link
Author

juri-diener commented May 2, 2024

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.

@AnilMaktala
Copy link

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 AnilMaktala added question Further information is requested pending-response labels May 3, 2024
@juri-diener
Copy link
Author

@AnilMaktala Yes, they have the same OrgID.

@juri-diener
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants