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

Subscriptions with arguments not working with chat sample #109

Closed
Stereobit opened this issue May 23, 2020 · 3 comments
Closed

Subscriptions with arguments not working with chat sample #109

Stereobit opened this issue May 23, 2020 · 3 comments

Comments

@Stereobit
Copy link

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
  }
}
@Sunac
Copy link

Sunac commented May 23, 2020

Maybe I'm wrong, but at first sight it looks you should include your argument 'conversationId' in list of mutation fields.
Responses are filtered out by the argument if you specify them, and your response from mutation must contain that conversationId if you want to be received by subscription.
Subscription response will just reflect what's sent from the mutation.

@Stereobit
Copy link
Author

Maybe I'm wrong, but at first sight it looks you should include your argument 'conversationId' in list of mutation fields.
Responses are filtered out by the argument if you specify them, and your response from mutation must contain that conversationId if you want to be received by subscription.
Subscription response will just reflect what's sent from the mutation.

Hmmm, that fixed it. This seems very confusing to me my assumption was that it is filtered by the argument I send in the mutation, not the one that I query for. Thanks for clearing this up.

@Sunac
Copy link

Sunac commented May 23, 2020

Wlcm ;).
For better understanding, you can check this blog post:https://aws.amazon.com/blogs/mobile/appsync-realtime/

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

No branches or pull requests

2 participants