hasura / hasura/graphql-engine

websocket-log has broken format

Open
#9,408 5 comments 8 reactions 1 assignee Claimed by @manasag View on GitHub
k/bug
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: v2.17.1

### Environment

OSS

### What is the current behavior?

Example log:
```
{"connection_info":{"msg":null,"token_expiry":"2023-01-30T21:45:25Z","websocket_id":"449a041f-a1a3-40e6-bd7d-36e75a004e35"},"event":{"detail":{"operation_id":"user_keep_alivebfbc0a3d-2f39-4afc-835e-41f14014cb6a","operation_name":"userKeepAlive","operation_type":{"type":"started"},"parameterized_query_hash":"e86ed74796559dde497acb48994b1f5afdf30b25","query":{"operationName":"userKeepAlive","query":"subscription userKeepAlive(\n $user_id: String!,\n $client_token: String!\n) {\n sessions: user_sessions(where: {\n user_id: {_eq: $user_id},\n client_token: {_eq: $client_token}}\n ) {\n is_online\n }\n}\n"},"request_id":"7aa82d15-9869-471c-a197-979ceb48a6fa"},"type":"operation"},"user_vars":{"x-hasura-role":"user","x-hasura-user-id":"ndtBlQG662PvnL5frN4U6LO2gqW2"}}
```
It's expected to be:
```
{"connection_info":{"msg":null,"token_expiry":"2023-01-30T21:45:25Z","websocket_id":"449a041f-a1a3-40e6-bd7d-36e75a004e35"},"event":{"detail":{"operation_id":"user_keep_alivebfbc0a3d-2f39-4afc-835e-41f14014cb6a","operation_name":"userKeepAlive","operation_type":{"type":"started"},"parameterized_query_hash":"e86ed74796559dde497acb48994b1f5afdf30b25","query":{"operationName":"userKeepAlive","query":"subscription userKeepAlive(\n $user_id: String!,\n $client_token: String!\n) {\n sessions: user_sessions(where: {\n user_id: {_eq: $user_id},\n client_token: {_eq: $client_token}}\n ) {\n is_online\n }\n}\n","variables":{"client_token":"ffadd369eb02475aaa911fd6d59343ea68921316f89b55e66642aba2f319a68c","user_id":"ndtBlQG662PvnL5frN4U6LO2gqW2"}},"request_id":"7aa82d15-9869-471c-a197-979ceb48a6fa"},"type":"operation"},"user_vars":{"x-hasura-role":"user","x-hasura-user-id":"ndtBlQG662PvnL5frN4U6LO2gqW2"}}
```
Example above is the same query from Server Version v2.10.2.

According to [doc](https://hasura.io/docs/latest/deployment/logging/#websocket-log-structure) there should be field
`detail.event.detail.query.variables`, but it's missing in current version

### What is the expected behavior?

It's expected to log variables passed to WS

### How to reproduce the issue?

1. Install OSS version of Hasura
2. Enable websocket-log
3. Make subscription
4. Check logs

### Any possible solutions/workarounds you're aware of?

The solution for now is to keep running the old version.

### log diff
missing filed highlighted
```diff
{
"connection_info": {
"msg": null,
"token_expiry": "2023-01-30T21:45:25Z",
"websocket_id": "449a041f-a1a3-40e6-bd7d-36e75a004e35"
},
"event": {
"detail": {
"operation_id": "user_keep_alivebfbc0a3d-2f39-4afc-835e-41f14014cb6a",
"operation_name": "userKeepAlive",
"operation_type": {
"type": "started"
},
"parameterized_query_hash": "e86ed74796559dde497acb48994b1f5afdf30b25",
"query": {
"operationName": "userKeepAlive",
"query": "subscription userKeepAlive(\n $user_id: String!,\n $client_token: String!\n) {\n sessions: user_sessions(where: {\n user_id: {_eq: $user_id},\n client_token: {_eq: $client_token}}\n ) {\n is_online\n }\n}\n",
- "variables": {
- "client_token": "ffadd369eb02475aaa911fd6d59343ea68921316f89b55e66642aba2f319a68c",
- "user_id": "ndtBlQG662PvnL5frN4U6LO2gqW2"
- }
},
"request_id": "7aa82d15-9869-471c-a197-979ceb48a6fa"
},
"type": "operation"
},
"user_vars": {
"x-hasura-role": "user",
"x-hasura-user-id": "ndtBlQG662PvnL5frN4U6LO2gqW2"
}
}
```

### Keywords
websocket-log, subscription log

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.