Closed CodySwannGT closed 4 years ago
Hello @CodySwannGT does the subscription trigger from the AppSync Console?
@SwaySway I think you're asking, if I run the mutation in the AppSync console, does the subscription trigger from the app?
If so, no, it does not.
If you're asking if I can create a subscription from the AppSync query console, I got a message that subscriptions weren't allowed when I tried that.
@CodySwannGT From my experience using the AppSync service, after call .subscribe(..) on an API, it take a couple of seconds for the subscription to fully setup, in my tests, I usually use setTimeout to wait for 2 to 5 seconds before I send the mutations, and the subscription works as expected. In your project the mutation and subscription are both sent by the useEffecct(.) method, it's very likely that the AppSync service is not given enough time to fully setup the subscription for your project. Try to setup the subscription first and then wait for a few seconds before you start to send the mutations (consider also use other react life cycle events to achieve this?)
BTW, you can test subscriptions on AppSync query console.
@UnleashedMind What am I doing wrong?
As I pointed out above, you need to first setup the subscription, then wait for a couple of seconds, then send the mutations. Could you verify that in your code the mutation is sent AFTER the subscibe(.) method is called?
And when you use the AppSync Console, you need to open two consoles to test subscriptions. On one console, run the subscription. Then open another console, go to the Queries Console of the same API, and run mutation. After the mutation is successfully executed, you will see the subscription data in the first console.
@UnleashedMind sorry for the miscommunication. I saw your first response and my reply was simply related to the AppSync Console.
That said, I tried (and recorded) doing as you said and I still got nice dice
I also can confirm the mutation is sent AFTER the subscribe(.) method is called, but that seems like a moot point if the subscription is not even working from console
@UnleashedMind Anything else I can provide? Pretty desperate for a solution on this one.
@CodySwannGT - can we get on a call together? We're trying to get to the bottom of this but just require more hands-on time. Can you DM me on Twitter?
@CodySwannGT I used the exact auth setup (email or phone) and I still cannot reproduce your issue.
Could you try to create another project from ground up with the schema and auth type? See if subscription works. Could you send us the AppSync API region, name, ID (you can find it in the Settings) in email? so we can ask the AppSync team to help to troubleshoot.
Yep. As discussed, we're successfully using subscriptions on other projects.
I'm not sure when I'll have time to setup a brand new project, but I can certainly send you the AppSync info.
@CodySwannGT The AppSync service had an issue, subscription does not work if the schema contains union or interface, that issue has just been fixed yesterday. Is there interface or union in the schema of this project? Could you try again and see if the issue is still there.
Sorry for the delay. Literally just tried it from console and got nothing.
I also spun up a brand new app in a different account and it worked fine.
Unfortunately, this is a pretty robust stack, so tearing it down isn't it an option
The question still stand: Is there interface or union in the schema of this project? Could you send me the exact time (including the time zone) when you sent the subscription and the mutations? (You can test it again if you don't remember the exact time you tested last time). So I can contact the AppSync team with the information and they can track the history to dig to the root of the issue.
No. I posted by entire amplify folder, including the graphql schema. No interfaces or unions.
I"m afk but I will grab the time next time I test it.
Hi @CodySwannGT - based on the investigation, the issue seems to be in AppSync. The best way to get engagement on this issue is to create a customer support ticket through the AWS Management Console. Closing this as the issue is not in the Amplify CLI repo.
Uh. Sure. Done: https://www.dropbox.com/s/io7e91f9fwofgiz/Screenshot%202020-07-07%2008.45.36.png?dl=0
What's your advice for anyone who isn't pay for support?
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.
Describe the bug Using the Amplify GraphQL Client to subscribe to a subscription and call a mutations does not result in a socket notification via the subscription
Amplify CLI Version 4.21.1
To Reproduce
Expected behavior Calling the mutation should result in the subscripting firing
Desktop (please complete the following information):
Additional context
Amplify folder