grapqhl-ws/client : malformed query error are swallowed and client simply "completes"
See original GitHub issueHello 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:
- Created 2 years ago
- Comments:25 (15 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
I mean, this is OSS, you can always fork the repo, apply your changes,
yarn build
,yarn pack
and in your appyarn add ../graphql-ws/package.tgz
. 😄