GraphQL Transform AppSync service error: not supported through the realtime channel
See original GitHub issueDescribe the bug I am trying out this tutorial here: https://dev.to/playra/aws-datastore-283f
I’m trying to get subscriptions working through AWS AppSync Console on the queries tab, but the service is returning a bunch of errors.
- schema uses model and auth directive,
- backend provisioned for DataStore
- no libraries used, tests done through AWS AppSync Console
Amplify CLI Version
4.18.0
To Reproduce Steps to reproduce the behavior or terminal output if applicable
amplify init
,amplify add auth
, choose emailamplify add api
, Use this schema,
type Job
@model
@auth(
rules: [
{allow: owner, ownerField: "owner", operations: [create, update, delete]},
])
{
id: ID!
position: String!
rate: String!
description: String!
owner: String
}
amplify update api
, choose enable for DataStoreamplify push
amplify console auth
, user pools, create a user with verified email, note the sub of the user, grab the app client id from the other tab as well,- amplify console api, Queries tab, login using the app client id, email, and password, will prompt to update password, then make sure you are logged in.
- Create a new Job
mutation createJob($input: CreateJobInput!) {
createJob(input: $input) {
id
position
rate
description
owner
_version
_deleted
_lastChangedAt
}
}
{
"input": {
"id": "111",
"position": "1",
"rate": "100",
"description": "desc",
"owner": "eb8f6fc5-78b7-41a1-b1fa-9bc6dd61bdb7" // replace this with your sub
}
}
- Job is created successfully. Open another console to create a subscription on the data
subscription onCreateJob($owner: String!){
onCreateJob(owner: $owner) {
id
position
rate
description
owner
_version
_deleted
_lastChangedAt
}
}
{
"owner": "eb8f6fc5-78b7-41a1-b1fa-9bc6dd61bdb7"
}
- Fails with
Error: {
"errors": [
{
"message": "Connection failed: {\"errors\":[{\"errorType\":\"UnsupportedOperation\",\"message\":\" not supported through the realtime channel\"}]}"
}
]
}
at Object.error (https://d2i3s4ccv6vp01.cloudfront.net/c838cd42dec424b3e3864f2d31611d91308b8975/main.js:135:834636)
at d (https://d2i3s4ccv6vp01.cloudfront.net/c838cd42dec424b3e3864f2d31611d91308b8975/main.js:174:1290919)
at m (https://d2i3s4ccv6vp01.cloudfront.net/c838cd42dec424b3e3864f2d31611d91308b8975/main.js:174:1291263)
at e.value (https://d2i3s4ccv6vp01.cloudfront.net/c838cd42dec424b3e3864f2d31611d91308b8975/main.js:174:1292345)
at n._handleIncomingSubscriptionMessage (https://d2i3s4ccv6vp01.cloudfront.net/c838cd42dec424b3e3864f2d31611d91308b8975/main.js:135:664618)
Expected behavior Subscriptions work as expected.
Additional context
So interestingly this was working earlier: I was able to create a subscription connection, go back to other tab and create a Job mutation. my subscription got a bad response because because i missed putting description
in the selection set of the createMutation and subscription had selection set with description was expecting non-null description to come back… So i wonder if that caused the AppSync service to be in a weird state and now I can’t get the subscriptions to connect anymore.
When i miss adding the required selection set in the createJob mutation, the subsription received this error:
{
"data": {
"onCreateJob": null
},
"errors": [
{
"message": "Cannot return null for non-nullable type: 'String' within parent 'Job' (/onCreateJob/description)",
"path": [
"onCreateJob",
"description"
]
}
]
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
When using the AWS AppSync console to create subscriptions, make sure your document only has that single operation. I had two since i wanted to test the onCreateJob and onUpdateJob. Removing the second operation in my document worked
This is still an issue. When trying to establish a subscription through the AppSync console, it fails when there is more than a single operation present. It works fine as long as the subscription is the only operation.