From 516013bdc1cbfb4e1cba385a2f2c2482e3e2d882 Mon Sep 17 00:00:00 2001 From: Adam Misiorny Date: Wed, 16 Oct 2024 10:14:43 +0200 Subject: [PATCH] fix: TECH check if body exists before extracting operation name --- packages/gcloud-express-logger/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gcloud-express-logger/src/index.ts b/packages/gcloud-express-logger/src/index.ts index 9347e06..f65d06d 100644 --- a/packages/gcloud-express-logger/src/index.ts +++ b/packages/gcloud-express-logger/src/index.ts @@ -20,7 +20,7 @@ const requestLogMessage = (req: Request, res: Response, ms: number) => ({ }) const requestOperationName = (req: Request): string | undefined => { - if ('operationName' in req.body && typeof req.body.operationName === 'string') { + if (req.body && 'operationName' in req.body && typeof req.body.operationName === 'string') { return req.body.operationName }