GraphQL subscriptions are not available in API Playground

I created a GraphQL setting with a supergraph and a single subgraph. The supergraph’s configuration enables playground:

  "graphql": {
    "enabled": true,
    "version": "2",
    "playground": {
      "enabled": true,
      "path": "/playground"
    },
    ...
  }

The GraphQL schema offers a subscription:

type Subscription {
  mySubscription: String!
}

I then start Tyk and my sample backend app. Then, I open API Playground. It works well and I am able to run sample query.

But when I try to run the following subscription within API Playground:

subscription {
  mySubscription
}

the following error is displayed in the right panel:

Cannot read properties of undefined (reading 'SubscriptionClient')

Here’s a demo project illustrating the issue (notice that the code is in the subscriptions-playground branch, not in the main one): GitHub - andrey-nakin/tyk-issues at subscriptions-playground

Hi @Andrey_Nado,

Thank you for posting your issue here. We’re currently looking into this.

1 Like

Hi @Andrey_Nado ,
I can replicate your issue and it seems that this happens on the Gateway version (v4.1.0-rc15) you are using. I tried this with our sample code and I can see the same behavior. I filed a ticket internally for our team to check this further however there’s no estimated time of completion for this ticket at the moment.
I tried using other version (e.g. v4.0.0) and it seems that this error is not being returned. That said, you can use other lower versions of Gateway for now.

1 Like