fix(auth): revert SUPABASE_INTERNAL_URL — cookie name mismatch
Browser creates cookies keyed by the external hostname (sb-myeasycms-*), but server was using SUPABASE_INTERNAL_URL (sb-supabase-kong-*) — different keys = server can't find the session = infinite 'please wait' after login. Both client and server now use the same NEXT_PUBLIC_SUPABASE_URL (external domain). The SSR reaches Supabase via Traefik → Kong which works fine.
This commit is contained in:
@@ -2,18 +2,8 @@ import * as z from 'zod';
|
||||
|
||||
/**
|
||||
* Returns and validates the Supabase client keys from the environment.
|
||||
*
|
||||
* On the server, prefers SUPABASE_INTERNAL_URL (Docker-internal)
|
||||
* over NEXT_PUBLIC_SUPABASE_URL (external domain) to avoid
|
||||
* hairpin NAT / DNS issues in containerized deployments.
|
||||
*/
|
||||
export function getSupabaseClientKeys() {
|
||||
const isServer = typeof window === 'undefined';
|
||||
|
||||
const url = isServer
|
||||
? (process.env.SUPABASE_INTERNAL_URL || process.env.NEXT_PUBLIC_SUPABASE_URL)
|
||||
: process.env.NEXT_PUBLIC_SUPABASE_URL;
|
||||
|
||||
return z
|
||||
.object({
|
||||
url: z.string({
|
||||
@@ -24,7 +14,7 @@ export function getSupabaseClientKeys() {
|
||||
}),
|
||||
})
|
||||
.parse({
|
||||
url,
|
||||
url: process.env.NEXT_PUBLIC_SUPABASE_URL,
|
||||
publicKey: process.env.NEXT_PUBLIC_SUPABASE_PUBLIC_KEY,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user