Subscriptions with arguments not working
See original GitHub issueDescribe the bug I’m not able to receive any updates from subscriptions when using arguments in my application. I am able to reproduce the issue using the chat sample app while only using the AWS console so I’ll leave any other setup out here.
To Reproduce
- Create new AppSync App
- Pick Chat Sample
- Run Query
subscription {
subscribeToNewMessage(conversationId: "myNewId") {
content
createdAt
}
}
- Run Query
mutation CreateMessage {
createMessage(content: "Second!" conversationId: "myNewId" createdAt: "This afternoon" id: "messageOneId") {
content
createdAt
}
}
Expected behavior
The subscription receives the results of the createMessage
mutation.
Additional context If I remove the argument from the subscription it works as expected
type Subscription {
subscribeToNewMessage: Message @aws_subscribe(mutations: ["createMessage"])
}
subscription {
subscribeToNewMessage {
content
createdAt
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
AWS AppSync Subscription Arguments Not Working
I'm going crazy over subscriptions with AWS AppSync. My problem is that I can't figure out how to get a filtered subscription. When...
Read more >Subscriptions - Apollo GraphQL Docs
In the majority of cases, your client should not use subscriptions to stay ... Apollo Client that contains loading , error , and...
Read more >Filtering GraphQL Subscriptions with Arguments with AWS ...
When working with real-time data in GraphQL, a very common use case is the need to filter subscriptions based on arguments (think about...
Read more >Publications and Data Loading - Meteor Guide
If the subscription and fetch are separated, then it's not always clear how and why changes to the subscriptions (such as changing arguments),...
Read more >Subscriptions - Ariadne GraphQL
While queries offer a way to query a server once, subscriptions offer a way for the ... def on_connect(websocket, params: Any): if not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@attilah I’ve now figured out what the issue is. My assumption was that the subscriptions are filtered by the arguments I send in my mutation, not the ones I receive. If I add the field to my mutation it works:
This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server
*-help
channels for those types of questions.