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.

GraphiQL.createFetcher does not work for subscriptions-transport-ws

See original GitHub issue

As shown in this PR on express-graphql: https://github.com/graphql/express-graphql/pull/739/files#diff-f851f2ce2fbcb0220aaca183def93d7ced5b533fead2016551cfd6d37b357ae5, I started the graphql server with subscription using legacy subscriptions-transport-ws.

Then on the client side I create fetcher like this:

window.GraphiQL.createFetcher({url: fetchURL, subscriptionUrl: ${safeSerialize(
            subscriptionEndpoint,
          )}});

Then I got error as shown in the below screenshot: Screen Shot 2021-02-10 at 9 29 46 PM

The same client side code works if I started a graphql server using graphql-ws though: https://github.com/graphql/express-graphql/pull/739/files#diff-4f5f57981087dfef3de9e960e86656c7a1d1ef9f424fd0a75e32751163a286e1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
acaocommented, Mar 29, 2021

@junminstorage introduced the legacyClient option as requested in the above PR, and just made it so that only graphql-ws is tried with subscriptionsUrl since the failover logic is too complex and unnecessary, when most projects are instantiating a custom client instance anyways.

thanks for all your work @junminstorage getting this working in the ecosystem, hoping to help you get everything working nicely here and in express-graphql in the following weeks!

0reactions
junminstoragecommented, Mar 29, 2021

@acao make sense. thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Use Subscriptions in GraphiQL - Apollo GraphQL Blog
Finally, all you have to do is start your server, open your browser in http://localhost:3000/graphiql, write a GraphQL subscriptions query ...
Read more >
@graphiql/create-fetcher - npm package | Snyk
The npm package @graphiql/create-fetcher was scanned for known vulnerabilities and missing license, and no issues were found. Thus the package was deemed as ......
Read more >
graphiql - npm
Automatically adds required fields to queries. Documentation explorer, search, with markdown support. Query History using local storage; Run and ...
Read more >
graphiql/toolkit - UNPKG
@graphiql/toolkit/docs/create-fetcher.md. Version: ... which act as client reference implementations of the [GraphQL over HTTP Working Group ...
Read more >
@graphiql/toolkit | Yarn - Package Manager
This is a general purpose library for building GraphQL IDEs. ... like graphiql and @graphiql/react and also provides utilities that are useful when...
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