From 88e6b578988f401cc895ba5fd8696d30a7a2ddfb Mon Sep 17 00:00:00 2001 From: "A. David Thyresson" Date: Mon, 21 Mar 2022 18:08:42 -0400 Subject: [PATCH] Handle case when requestContext is undefined getting protocol --- packages/graphql-server/src/functions/graphql.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/graphql-server/src/functions/graphql.ts b/packages/graphql-server/src/functions/graphql.ts index a860e058448f..248958111d46 100644 --- a/packages/graphql-server/src/functions/graphql.ts +++ b/packages/graphql-server/src/functions/graphql.ts @@ -262,7 +262,7 @@ export const createGraphQLHandler = ({ } } - const requestProtocol = event.requestContext.protocol || 'http' + const requestProtocol = event.requestContext?.protocol || 'http' const requestUrl = new URL(event.path, requestProtocol + '://localhost') let request: Request if (event.httpMethod === 'GET' || event.httpMethod === 'HEAD') {