graphql-ws icon indicating copy to clipboard operation
graphql-ws copied to clipboard

onConnect error message does not go to client

Open mattkrick opened this issue 6 months ago • 4 comments

The onConnect handler says throwing an error propagates that message to the client: https://github.com/enisdenjo/graphql-ws/blob/5161bd91388677893badb8dbaca5c6587095199b/src/server.ts#L214-L217

However, this isn't true in production: https://github.com/enisdenjo/graphql-ws/blob/5161bd91388677893badb8dbaca5c6587095199b/src/use/uWebSockets.ts#L206-L207

So if the client handles things differently based off that message, it'll work great in development, but break in production 😬 .

Looks like the reason was to limit the size of the message, which is understandable, but chances are most messages will still be < 1 MTU so it shouldn't make any real difference. Would it be possible to send the message to the client so the code works in prod just like it does in dev?

mattkrick avatar Apr 09 '25 21:04 mattkrick