graphiql icon indicating copy to clipboard operation
graphiql copied to clipboard

`export 'createClient' was not found in 'graphql-ws'`

Open MrJoy opened this issue 3 years ago • 4 comments

I'm experiencing this issue after explicitly adding graphql-ws as a dependency. Unfortunately, I'm using Webpacker (Ruby on Rails), so I don't really have direct access to the webpack config to figure out what's going wrong or work around it.

There's two things that are especially weird here:

  1. I'm not actually using createGraphiQLFetcher. The root source file this bundle is below.
  2. This happens after asset bundles are actually produced, so I can actually use things in development. I just can't deploy because this breaks my CI process.
import React from "react";
import ReactDOM from "react-dom";
import GraphiQL from "graphiql";

const App = () => (
  React.createElement(GraphiQL, {
    fetcher: async graphQLParams => {
      const data = await fetch(
        window.location.origin + "/v1",
        {
          method: "POST",
          headers: {
            Accept: "application/json",
            "Content-Type": "application/json",
          },
          body: JSON.stringify(graphQLParams),
        },
      );
      return data.json().catch(() => data.text());
    }
  })
);

ReactDOM.render(React.createElement(App), document.getElementById('root'));

Any thoughts on what I might be getting wrong here? What extra information can I provide to make it easier to help sort out what's happening?

MrJoy avatar May 18 '22 22:05 MrJoy

Hey @MrJoy 👋 can you please provide the graphiql version that you're using and the version of graphql-ws that you installed?

thomasheyenbrock avatar May 23 '22 16:05 thomasheyenbrock

I'm sorry, I should've thought to include that! >.<

The problem occurs with graphiql 1.8.10, but not 1.8.9. The installed version of graphiql-ws is 5.8.2.

MrJoy avatar May 23 '22 18:05 MrJoy

Also, it occurs to me my wording was vague: I am getting this even after adding graphql-ws. I don't actually use websockets, and only added it in an attempt to resolve a failure that resulted when updating graphiql.

MrJoy avatar May 27 '22 23:05 MrJoy

@thomasheyenbrock Hi, We're having the same issue. Were you able to find a workaround?

sava128 avatar Jun 09 '22 09:06 sava128