Skip to content

Commit

Permalink
fix: TECH check if body exists before extracting operation name
Browse files Browse the repository at this point in the history
  • Loading branch information
adam187 committed Oct 16, 2024
1 parent c2be227 commit 516013b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/gcloud-express-logger/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 516013b

Please sign in to comment.