question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Subscriptions with arguments not working

See original GitHub issue

Describe 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:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Stereobitcommented, May 23, 2020

@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:

mutation CreateMessage {
  createMessage(content: "Second!" conversationId: "myNewId" createdAt: "This afternoon" id: "messageOneId") {
    conversationId
    content
    createdAt
  }
}
0reactions
github-actions[bot]commented, May 26, 2021

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.

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found