question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GraphQL Transform AppSync service error: not supported through the realtime channel

See original GitHub issue

Describe 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

  1. amplify init, amplify add auth, choose email
  2. amplify 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
}
  1. amplify update api, choose enable for DataStore
  2. amplify push
  3. 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,
  4. 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.
  5. 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 
  }
}
  1. 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"
}
  1. 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:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
lawmichacommented, Apr 29, 2020

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

1reaction
blau2commented, Feb 11, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Real-time data - AWS AppSync
AWS AppSync allows you to utilize subscriptions to implement live application updates, push notifications, etc. When clients invoke the GraphQL subscription ...
Read more >
Websocket with AppSync: Error UnsupportedOperation ...
I think you need to put the "authorization" object inside an "extensions" property: _send({ id: localStorage.getItem(HeaderItems.
Read more >
[SOLVED] Using `client.subscribe` does not work? (to ...
I have a working Python code (see the subscription_client.py code on this page) that does receive subscriptions from AWS AppSync. I have tried...
Read more >
API (GraphQL) - Configure Lambda resolvers - Amplify Docs
Quickly & easily configure AWS Lambda resolvers within your AWS AppSync API. - AWS Amplify Docs.
Read more >
Yan Cui on Twitter: "Trying to test AppSync subscription via ...
... via the AppSync console, anyone know what does this error message mean? "not supported through the realtime channel" it's not obvious to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found