fix: prevent resolving internal supabase urls to localhost inside docker container
All checks were successful
Staging Build / build (push) Successful in 3m37s
All checks were successful
Staging Build / build (push) Successful in 3m37s
This commit is contained in:
@@ -43,6 +43,7 @@ ARG NEXT_PUBLIC_SUPABASE_URL
|
|||||||
ARG NEXT_PUBLIC_SUPABASE_ANON_KEY
|
ARG NEXT_PUBLIC_SUPABASE_ANON_KEY
|
||||||
ENV NEXT_PUBLIC_SUPABASE_URL=$NEXT_PUBLIC_SUPABASE_URL
|
ENV NEXT_PUBLIC_SUPABASE_URL=$NEXT_PUBLIC_SUPABASE_URL
|
||||||
ENV NEXT_PUBLIC_SUPABASE_ANON_KEY=$NEXT_PUBLIC_SUPABASE_ANON_KEY
|
ENV NEXT_PUBLIC_SUPABASE_ANON_KEY=$NEXT_PUBLIC_SUPABASE_ANON_KEY
|
||||||
|
ENV IS_DOCKER=true
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
ENV PORT=3000
|
ENV PORT=3000
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ export function resolveSupabaseUrl(url: string | undefined): string | undefined
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Server-Side fallback to localhost:8000 (for local development)
|
// Server-Side fallback to localhost:8000 (for local development)
|
||||||
|
if (process.env.IS_DOCKER !== 'true') {
|
||||||
try {
|
try {
|
||||||
const parsed = new URL(url);
|
const parsed = new URL(url);
|
||||||
if (parsed.hostname === 'supabase-kong' || parsed.hostname === 'kong') {
|
if (parsed.hostname === 'supabase-kong' || parsed.hostname === 'kong') {
|
||||||
@@ -57,5 +58,6 @@ export function resolveSupabaseUrl(url: string | undefined): string | undefined
|
|||||||
.replace('//kong', '//localhost:8000');
|
.replace('//kong', '//localhost:8000');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user