From 4e52544c79ff8a5439034b11192ca4e3052ecfda Mon Sep 17 00:00:00 2001 From: WorkClub Automation Date: Sat, 21 Mar 2026 13:46:35 +0100 Subject: [PATCH] Add API_INTERNAL_URL to frontend deployment for K8s The Next.js rewrites were falling back to localhost:5001 because API_INTERNAL_URL was not set. This caused API proxy errors. - Added API_INTERNAL_URL=http://workclub-api:8080 - This allows Next.js to proxy /api/* calls to the internal backend service --- frontend/src/auth/auth.ts | 6 ++++++ infra/k8s/base/frontend-deployment.yaml | 2 ++ 2 files changed, 8 insertions(+) diff --git a/frontend/src/auth/auth.ts b/frontend/src/auth/auth.ts index 257f16f..32f7033 100644 --- a/frontend/src/auth/auth.ts +++ b/frontend/src/auth/auth.ts @@ -96,6 +96,12 @@ export const { handlers, signIn, signOut, auth } = NextAuth({ session.user.isAdmin = token.isAdmin as boolean | undefined } session.accessToken = token.accessToken as string | undefined + + // Log session data for debugging + console.log('[Session Debug] Session user:', session.user); + console.log('[Session Debug] Token isAdmin:', token.isAdmin); + console.log('[Session Debug] Session isAdmin:', session.user?.isAdmin); + return session } } diff --git a/infra/k8s/base/frontend-deployment.yaml b/infra/k8s/base/frontend-deployment.yaml index 45817e9..0b93e26 100644 --- a/infra/k8s/base/frontend-deployment.yaml +++ b/infra/k8s/base/frontend-deployment.yaml @@ -50,6 +50,8 @@ spec: env: - name: NODE_ENV value: "production" + - name: API_INTERNAL_URL + value: "http://workclub-api:8080" - name: NEXT_PUBLIC_API_URL valueFrom: configMapKeyRef: