fix: improve error handling in GraphQL connection parameters

- Replaced error throws with logging for missing connection parameters in the GraphQL module.
- Enhanced the logging mechanism to provide better insights during connection failures, improving overall debugging and monitoring capabilities.
This commit is contained in:
2024-12-05 22:47:26 +07:00
parent de46499288
commit 6eafc6d5ef

View File

@@ -109,10 +109,10 @@ import { PubSubService } from 'src/PubSub/pubsub.service'
'graphql-ws': {
onConnect: (ctx: Context<Record<string, unknown>>) => {
if (!ctx.connectionParams) {
throw new Error('No connectionParams provided')
Logger.log('No connectionParams provided', 'GraphqlModule')
}
if (!ctx.extra) {
throw new Error('No extra provided')
Logger.log('No extra provided', 'GraphqlModule')
}
// @ts-expect-error: Request is not typed
ctx.extra.request.headers['x-session-id'] = ctx.connectionParams['x-session-id']