hasura / hasura/graphql-engine

Non-compliant WebSocket message when JWT token expires

Open
#9,765 2 comments 1 reaction 0 assignees View on GitHub
k/bug
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: 2.29.0

### Environment

OSS

### What is the current behaviour?

When the JWT token used to establish a WebSocket connection expires, Hasura sends this WebSocket message:

```json
{
"type":"connection_error",
"payload":"Could not verify JWT: JWTExpired"
}
```

As far as I can tell this is not [spec-compliant](https://github.com/enisdenjo/graphql-ws/blob/HEAD/PROTOCOL.md). The main practical issue is that the `graphql-ws` library doesn't recognize the message and throws a different error, effectively swallowing the original message payload.

### What is the expected behaviour?

Hasura should return a spec-compliant error message.

### How to reproduce the issue?

1. Establish an authenticated WS connection
2. Start a subscription
3. Wait until JWT token expires

### Keywords

graphql-ws
websocket
jwtexpired

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.