mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
b19c27f045
The /api/ops/* proxy was a next.config.ts rewrite, which Next.js evaluates at `next build` and freezes into the prebuilt Docker image. The shared CI build bakes a placeholder OPS_BASE_URL (http://ops.invalid) to satisfy a throw-if-unset guard, so every deploy of the single :latest image proxied to a dead host regardless of its runtime env — /api/ops/* returned 500 (ENOTFOUND ops.invalid), the Feature Matrix health overlay got no probe data, and every cell downgraded to amber (zero green) despite green backend data. The same freeze also baked the production harness URL into the shared image, so even a correct rebuild would point staging at the prod harness. Replace the build-time rewrite with a Route Handler at src/app/api/ops/[...path]/route.ts that reads process.env.OPS_BASE_URL at REQUEST time (force-dynamic, never statically cached) and proxies /api/ops/<path> -> ${OPS_BASE_URL}/api/<path>, forwarding method, query string, headers, and body. A missing OPS_BASE_URL now returns a clear 503 instead of a build throw. The build no longer depends on OPS_BASE_URL. This fixes both traps with one image: each environment resolves its own runtime OPS_BASE_URL from the same artifact, no rebuild. Requires the dashboard image to rebuild + redeploy. Harness path is now /api/probes.
1.3 KiB
1.3 KiB