From 46e2902b9d6130ddbc3b5cad0a8fe500e9610782 Mon Sep 17 00:00:00 2001 From: Thomas Coopman Date: Fri, 11 Mar 2022 09:47:33 +0100 Subject: [PATCH] fix(gatsby): null check for context (#35096) --- packages/gatsby/src/schema/resolvers.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/gatsby/src/schema/resolvers.ts b/packages/gatsby/src/schema/resolvers.ts index b071a2417b73d..8a67215c216c7 100644 --- a/packages/gatsby/src/schema/resolvers.ts +++ b/packages/gatsby/src/schema/resolvers.ts @@ -676,7 +676,7 @@ export function wrappingResolver( ) activity.start() } - if (context.telemetryResolverTimings) { + if (context?.telemetryResolverTimings) { time = process.hrtime.bigint() } @@ -687,7 +687,7 @@ export function wrappingResolver( } const endActivity = (): void => { - if (context.telemetryResolverTimings) { + if (context?.telemetryResolverTimings) { context.telemetryResolverTimings.push({ name: `${info.parentType}.${info.fieldName}`, duration: Number(process.hrtime.bigint() - time) / 1000 / 1000,