Skip to content

onConnect error message does not go to client #637

@mattkrick

Description

@mattkrick

The onConnect handler says throwing an error propagates that message to the client:

graphql-ws/src/server.ts

Lines 214 to 217 in 5161bd9

* Throwing an error from within this function will
* close the socket with the `Error` message
* in the close event reason.
*/

However, this isn't true in production:

isProd
? 'Internal server error'

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions