diff --git a/.changeset/long-spiders-pay.md b/.changeset/long-spiders-pay.md new file mode 100644 index 0000000000..4a4f4078c2 --- /dev/null +++ b/.changeset/long-spiders-pay.md @@ -0,0 +1,5 @@ +--- +'graphql-yoga': patch +--- + +Do not call CORS headers factory twice diff --git a/packages/graphql-yoga/src/plugins/useCORS.ts b/packages/graphql-yoga/src/plugins/useCORS.ts index fd7405bd73..2f60856069 100644 --- a/packages/graphql-yoga/src/plugins/useCORS.ts +++ b/packages/graphql-yoga/src/plugins/useCORS.ts @@ -144,14 +144,8 @@ export function useCORS>( return { async onRequest({ request, serverContext, fetchAPI, endResponse }) { if (request.method.toUpperCase() === 'OPTIONS') { - const headers = await getCORSResponseHeaders( - request, - corsOptionsFactory, - serverContext, - ) const response = new fetchAPI.Response(null, { status: 204, - headers, }) endResponse(response) }