diff --git a/shop/app/my-orders/page.tsx b/shop/app/my-orders/page.tsx index 538275f..46cd26a 100644 --- a/shop/app/my-orders/page.tsx +++ b/shop/app/my-orders/page.tsx @@ -6,6 +6,7 @@ import { Button } from '@/components/ui/button' import { Card, CardContent } from '@/components/ui/card' import { Badge } from '@/components/ui/badge' import type { Order } from '@/lib/types' +import { resolveSupabaseUrl } from '@/lib/utils' const statusLabel: Record = { pending: 'Eingegangen', @@ -142,12 +143,12 @@ export default async function MyOrdersPage() { {o.pdf_url && ( <> diff --git a/shop/app/order/success/page.tsx b/shop/app/order/success/page.tsx index 59eb150..4c3a40c 100644 --- a/shop/app/order/success/page.tsx +++ b/shop/app/order/success/page.tsx @@ -7,6 +7,7 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Separator } from '@/components/ui/separator' import { Badge } from '@/components/ui/badge' import type { Order } from '@/lib/types' +import { resolveSupabaseUrl } from '@/lib/utils' export default async function OrderSuccessPage({ searchParams, @@ -150,12 +151,12 @@ export default async function OrderSuccessPage({ {o.pdf_url && (
diff --git a/shop/components/admin/orders-table.tsx b/shop/components/admin/orders-table.tsx index 4a17953..9a5a5de 100644 --- a/shop/components/admin/orders-table.tsx +++ b/shop/components/admin/orders-table.tsx @@ -13,6 +13,7 @@ import { DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { updateOrderStatus } from "@/lib/actions/orders"; +import { resolveSupabaseUrl } from "@/lib/utils"; interface OrdersTableProps { initialOrders: any[]; @@ -225,7 +226,7 @@ export function OrdersTable({ initialOrders }: OrdersTableProps) { {order.pdf_url ? ( <> diff --git a/shop/lib/utils.ts b/shop/lib/utils.ts index de7d5a8..f07dd25 100644 --- a/shop/lib/utils.ts +++ b/shop/lib/utils.ts @@ -40,6 +40,22 @@ export function resolveSupabaseUrl(url: string | undefined): string | undefined } return resolved; } + } else { + // Server-Side fallback to localhost:8000 (for local development) + try { + const parsed = new URL(url); + if (parsed.hostname === 'supabase-kong' || parsed.hostname === 'kong') { + parsed.hostname = 'localhost'; + parsed.port = '8000'; + return parsed.toString().replace(/\/$/, ''); + } + } catch { + return url + .replace('//supabase-kong:8000', '//localhost:8000') + .replace('//kong:8000', '//localhost:8000') + .replace('//supabase-kong', '//localhost:8000') + .replace('//kong', '//localhost:8000'); + } } return url; }