From d1cc81ff53b5162d54741c4e28ea56c7474bff98 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Thu, 10 Sep 2026 20:47:21 +0100 Subject: [PATCH] fix(app): declare API_URL and APP_URL in the build task env The app build task overrides the root `build.env`, which lists API_URL and APP_URL, with a shorter list that omits both. Turborepo hides an undeclared variable from the task, so `next.config.ts` reads `process.env.API_URL` as undefined and bakes its `http://localhost:3001` fallback into the deployment. Both are build-time inputs rather than runtime ones, so `env` is correct and `passThroughEnv` is not: `next.config.ts` republishes API_URL as NEXT_PUBLIC_API_URL, which Next inlines into the bundle. A change to API_URL therefore has to invalidate the build cache, or a cached build keeps serving the previous host. Co-Authored-By: Claude Opus 5 --- apps/app/turbo.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/app/turbo.json b/apps/app/turbo.json index cea0ca0ed..c71a595a0 100644 --- a/apps/app/turbo.json +++ b/apps/app/turbo.json @@ -6,7 +6,12 @@ "dependsOn": ["^build"], "inputs": ["$TURBO_DEFAULT$", ".env*"], "outputs": [".next/**", "!.next/cache/**", "!.next/dev/**"], - "env": ["NEXT_PUBLIC_API_URL", "NEXT_PUBLIC_AUTH_URL"], + "env": [ + "API_URL", + "APP_URL", + "NEXT_PUBLIC_API_URL", + "NEXT_PUBLIC_AUTH_URL" + ], "passThroughEnv": [ "AGENT_BRIDGE_SECRET", "AGENT_URL",