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.

Using operationName immediately closes the connection

See original GitHub issue

Using operationName variable in client.subscribe immediately closes the connection

{
  query,
  variables,
  extensions: {
    userId: context?.userId,
  },
  operationName: context?.rootOperationInfo?.operationName,
}

As soon as I remove the operationName, it works. I’m using version “graphql-ws”: “^4.7.0” As a workaround I am using

{
  query,
  variables,
  extensions: {
    userId: context?.userId,
  operationName: context?.rootOperationInfo?.operationName,
  },
}

Please let me know if you need more info.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
quant-daddycommented, May 31, 2021

Okay so in the error cb here

{
  next: (data) => {
    pending.push(data);
    deferred && deferred.resolve(false);
  },
  error: (err: Error) => {
    console.log(err);

    error = err;
    deferred && deferred.reject(error);
  },
  complete: () => {
    done = true;
    deferred && deferred.resolve(true);
  },
}

I get the error [ { message: 'Unable to identify operation' } ] thrown from the line here. I think I know why the error occurs: the operation name in the document is actually not context?.rootOperationInfo?.operationName for a workaround that I am using 😃

0reactions
enisdenjocommented, May 31, 2021

Just surround your server callbacks with a try/catch and log the caught errors.

Read more comments on GitHub >

github_iconTop Results From Across the Web

API Reference: ApolloServer - Apollo GraphQL Docs
Wait for all connections to be closed; After a grace period, if any connections remain active, forcefully close them. If you're using startStandaloneServer...
Read more >
GraphQL error: No operation named "" · Issue #1760 - GitHub
Just started getting this error this morning using the Shopify Storefront API. I resolved it using a similar method as @leowmjw: import { ......
Read more >
Remote Desktop Connection closed immediately after ...
In this case perform a system file check: - Press Windows Key + X to open Win + X menu. Now select Command...
Read more >
Connection closes immediately on open - Stack Overflow
To replicate run the python code as admin, open any JS console and enter the JS code. My desired outcome is for the...
Read more >
centos - SSH closing by itself - root works fine - Server Fault
I'm trying to connect to a server but if i use any other user than root the connection closes itself after a successful...
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