From ececa65c78babf1a00aeb12d36051ae73884c476 Mon Sep 17 00:00:00 2001 From: Sasha <64744993+r1tsuu@users.noreply.github.com> Date: Tue, 11 Feb 2025 20:22:16 +0200 Subject: [PATCH] fix(next): pre-flight OPTIONS request errors from the graphql endpoint (#11103) Fixes https://github.com/payloadcms/payload/issues/11101 --- packages/next/src/routes/rest/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/next/src/routes/rest/index.ts b/packages/next/src/routes/rest/index.ts index 419bd72e41..533c639aef 100644 --- a/packages/next/src/routes/rest/index.ts +++ b/packages/next/src/routes/rest/index.ts @@ -34,7 +34,9 @@ const handlerBuilder = const response = await handleEndpoints({ config, - path: `${awaitedConfig.routes.api}/${awaitedParams.slug.join('/')}`, + path: awaitedParams + ? `${awaitedConfig.routes.api}/${awaitedParams.slug.join('/')}` + : undefined, request, })