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.

grapqhl-ws/client : malformed query error are swallowed and client simply "completes"

See original GitHub issue

Hello All,

Client graphql-ws v5.5.0 on nodejs v14.17.0

Server : Hasura v2.0.9

Expected Behaviour I expect graphql-ws/client to show an error when a query is malformed.

Actual Behaviour Instead it simply close the connection (complete event) without providing any clue. So, if you do not have access to server’s logs : you don’t understand why this behaviour happen.

It shows nothing even if I add all possible events handlers in my client. e.g. :

const client = createClient({
       ....
        on: {
            connected: () => {
                debug('connected');
            },
            connecting: () => {
                debug('connecting');
            },
            opened: () => {
                debug('opened');
            },
            closed: () => {
                debug('closed');
            },
            message: (msg) => {
                debug('message', msg);
            },
            ping: (msg) => {
                debug('ping', msg);
            },
            pong: (msg) => {
                debug('pong', msg);
            },
            error: (err) => {
                console.error(err);
            },
        },
        onNonLazyError: (errorOrCloseEvent) => {
            console.error(errorOrCloseEvent);
        },
    });

Debug Information To reproduce, simply add a typo in your query/subscription and boom : it “completes” instead of throwing.

Thanks for adding proper error handlers in that case. Clue : in the catch at line 642 (client.ts) : simply rethrow or at least print the error message.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:25 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
nomocascommented, Oct 20, 2021

Yes : Invalid message means termination through CloseEvent in close handler. No problem with that. Actual hasura payload should trigger CloseEvent(‘Invalid Message’). true.

And this will still true if the invalid message is provided, by any way, as convenience, to any developer that encounter it.

What is also true, is that Hasura issues take a long time to be tackled, there is 1.4 K open issues at this moment, and we have really few insight about the road-map. Even if it’s one of the biggest project around graphql… So, ok, no choice, we’ll wait and see.

And so last try, even a debug mode that, when enabled, print what is happening under the hood ?

Whatever, already thanks for your time.

0reactions
enisdenjocommented, Oct 21, 2021

I mean, this is OSS, you can always fork the repo, apply your changes, yarn build, yarn pack and in your app yarn add ../graphql-ws/package.tgz. 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

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