From 3670133366c0d392042585c647300b89789c478d Mon Sep 17 00:00:00 2001 From: Tony Xiao Date: Sat, 29 Apr 2023 09:14:44 +0200 Subject: [PATCH] Workaround Error: The "host" request header is not available https://github.com/supabase/auth-helpers/issues/341#issuecomment-1528696953 --- apps/web/server/server-helpers.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/web/server/server-helpers.ts b/apps/web/server/server-helpers.ts index d96e49df..4908488d 100644 --- a/apps/web/server/server-helpers.ts +++ b/apps/web/server/server-helpers.ts @@ -132,6 +132,10 @@ export async function serverGetViewer( headers: () => ({get: () => undefined}), cookies: () => ({get: () => undefined}), ...context, + // Workaround for https://github.com/supabase/auth-helpers/issues/341#issuecomment-1528696953 + // Setting cookie is not supported inside server components anyways. + // @see https://github.com/supabase/auth-helpers/blob/main/packages/shared/src/supabase-server.ts#L68 + cookieOptions: {secure: true}, }) const {data: sessionRes} = await supabase.auth.getSession()