-
Notifications
You must be signed in to change notification settings - Fork 266
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 generated graphql subscription not running #339
Comments
@cosinus84 - Thanks for posting this issue. What is the error output you are receiving in the console? |
There is no error, simply in the second browser tab where the subscription is running (in aws appsync console), there is no response. On the first browser tab I am running in console: |
input CreateNotesInput { input DeleteNotesInput { type Mutation { type Notes { type NotesConnection { type Query { type Subscription { input TableBooleanFilterInput { input TableFloatFilterInput { input TableIDFilterInput { input TableIntFilterInput { input TableNotesFilterInput { input TableStringFilterInput { input UpdateNotesInput { |
@cosinus84 What happens when you run the subscription without any values in the ()? So like this:
Also (and excuse the silly question) you are clicking the run button on the console when you modify the subscription, yeah? |
subscription { In other words the generated creation subscription is not working with the params even if they are optional. But works well without any of params. |
@cosinus84 - When you do use params, what are you using? From what I can tell, it kind of looks like you are trying to use all three properties from the Note object... which means the subscription will only be triggered when the created Note is identifical to what's in the subscription params, and if that's the case the subscription isn't necessarily needed. |
For example on IOS the params are optional, default to nil (null) so you can call the subscription without params |
Can you give an example of an actual parameter value you are trying to use in a subscription when it is not working? |
Even this is sdk-js, I don't think is any different then swift. All the code is generated by appsync automatically
listen for subscription in code
But it works with the following code.
|
Short explanation: I think the subscription in the screenshot is evaluating to Longer Answer: The subscription has 3 query variables defined for the operation ( |
I understand, but those params are not required so they should be ignored if are not present. If you look at the code generated you can call the constructor with no params, should work. I say is an issue. |
@cosinus84 The params in the subscription would be ignored if the keys simply weren't present. But if you are including the keys but giving them a value of null, I believe the subscription would be listening for created objects with 'null' values. |
Yes this is true but they need a fix because code generated doesn't say such a thing. Or at least fix the created subscription, to be without params. |
Same problem here, was this solved? I can't get anything as passing variables into subscribeToMore, even if I use undefined/null value, nothing happened. I'm kind of wondering if the input different between mutation and subscription will cause error? mutation --> createNotes(input: CreateNotesInput!): Notes |
I can confirm this is still a problem in the console - the generated subscription syntax does not work properly, as the OP has described. |
Switched to flutter and firebase in the meantime (hope by 202x there will be some dart package from AWS). We are heavily using aws everywhere so I am still interested in appsync. @haverchuck do you have any news about this issue? |
Ok, so this is very annoying. I designed an entire API base on the pretence that if an argument's value is optional, it simply would be discarded from being passed into the resolver. (This is the case if you test your api with the web query panel). Now, that I am starting to test my code with the iOS SDK. All of the optional values are being passed in as null. Which is really annoying because I have to find some sort of "hack" to get around this and implement it in every single resolver so far. |
@returnzer0 which SDK are you using? The current issue posted sounds related to Appsync's default subscriptions not working. To better understand your issue with the iOS SDK, can you open an issue over in the repo you are using and provide more details? There will be a template there that will help us gather enough details |
Hi, have the same issue. Very confused, you expect autogenerated code to work. |
Any update on this? I am facing this same issue. |
Same here using the Amplify GraphQL Client. When I omit optional values I get no updates at all |
Faced a similar problem . The workaround is that you have to write a new subscription without the parameters that you are passing as null. You wont need to write any custom resolvers for it . For example, Lets say your onCreateType($param 1 string , $ param2) . If you pass param2 as null, you wont get any updates. onCreateType($param1 String) and then use this subscription in your code. Hope it helps ! |
This seems to correlate with the advice in the Argument null value has meaning section which states:
|
not working for me still, any workaround for this ? |
Appsync generated graphql subscription is not working (tested using console). I think this is a big issue because when you start learning you expect at least generated things to work
//fails, generated by appsync
subscription OnCreateNotes($id: ID, $title: String, $body: String) { onCreateNotes(id: $id, title: $title, body: $body) { id title body } }
//works
subscription onNewCreateNotes { onNewCreateNotes { __typename id title body } }
The text was updated successfully, but these errors were encountered: