Subscription events are no longer being received
Describe the bug I have a subscription defined in amplify graphql, and being subscribed in Vue. The subscription events were being received, but recently stopped working.
Amplify CLI Version 4.21.3
To Reproduce Here is part of the definition:
type Mutation {
addMessage(channelID: ID!, content: String!): ID @function(name: "orchestraBackend-${env}") @auth(rules: [{allow: private, provider: userPools}])
}
type Subscription {
onNewMessage(channelID: ID!): ID @aws_subscribe(mutations: ["addMessage"])
}
I'm seeing the same issue on multiple (AppSync) projects, all managed by Amplify. One of them is in active development but I'm also seeing failed subscriptions on older projects that haven't been touched in months.
A few questions here
- Are you seeing any errors when you try to run the subscription?
- Are you using Amplify Lib or are you running these subscriptions from the console?
There is another issue on subscriptions not triggering we are tracking. We'd like to dive into this more and see they might be related. https://github.com/aws-amplify/amplify-cli/issues/4462
Hi @SwaySway , thanks for looking into this.
I'm using the Amplify libraries. I get back a subscription objection successfully with no errors.
I talked with the service team and there was a temporary issue with subscriptions that is resolved by now, please retry and if the issue persist get back to us, however the issue is not CLI related but we can help by asking the team in these situations. Another forum could be to ask in our community on discord at: https://discord.gg/amplify
@attilah Can you tell me more about the cause of the issue? The subscription issue has not resolved on my end. Some of my subscriptions are working, but the one I specified in this issue is not.
@brene This issue is still happening, can we reopen this please?
Cc @attilah @UnleashedMind
Hi @cjsedwards - I've been chatting with the AppSync PM. They were aware of an issue and it was fixed on June 18 at 8:50 UTC+2. Can you create a support ticket for the AWS AppSync team? That way they can pursue this issue further.
@brene Where do I do that? I don't see an AppSync github repo or a way to submit issues to them.
You can do so in the AWS console. Let me know if you have any other questions around this.

@cjsedwards when the subscription is triggered, can you see the start and start_ack message in websocket? You can find this in Network tab of Developer tools

Ok yes I am seeing this, I sent a message as well test test it out, and I didn't receive anything after the start_ack.

And I can confirm that I did send a message with the same channelID, here is the request I sent:

@cjsedwards would it be possible to share your schema. The part I am specifically interested in is the graphql transformers output schema (which is located in <project-root>/amplify/backend/api/<api-name>/build/scheam.graphql) the subscription type. I am wondering if the onNewMessage subscription has @aws_subscribe(mutation:["addMutation"])
@yuth

I see the subscription is wired correctly, and websocket connection for subscription is open and subscription has started. I am not sure why messages are not delivered to this subscription. I will ask the service team to help us diagnose this further.
@cjsedwards Do you have multiple subscriptions running at the same time? For instance one of the sub has channelId as parameter and others don't have it
Yes, my Vue app has a subscription to onCreateUnreadMessageCount, onUpdateUnreadMessageCount, and onDeleteUnreadMessageCount that are running at the same time.
@cjsedwards could you share the query used for the subscription and the mutation that used to trigger the subscription
Subscription:
{
"query": "subscription OnNewMessage($channelID: ID!) { onNewMessage(channelID: $channelID)}",
"variables": {
"channelID": "3f84f782-ab68-4135-9dc3-8041589d621b"
}
}
Mutation:
{
"query": " mutation AddMessage($channelID: ID!, $content: String!) { addMessage(channelID: $channelID, content: $content) }",
"variables": {
"channelID": "3f84f782-ab68-4135-9dc3-8041589d621b",
"content": "Test message"
}
}