From 3f97282ac96dc257b0c55f08c498c21c36f2968f Mon Sep 17 00:00:00 2001 From: Ho1yShif Date: Mon, 6 Jul 2026 14:11:53 -0700 Subject: [PATCH] fix: auto-inject frontend NEXT_PUBLIC_API_URL from backend service Replace the manual `sync: false` on the frontend's NEXT_PUBLIC_API_URL with a `fromService` reference to the backend's Render-injected RENDER_EXTERNAL_URL. This bakes the real public backend URL (including the unpredictable -XXXX slug suffix) into the static build at build time, removing the manual post-deploy step. No cyclic dependency: the backend defaults CORS to "*" and never references the frontend URL, so the dependency is one-directional (frontend -> backend). Co-Authored-By: Claude Opus 4.8 (1M context) --- render.yaml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/render.yaml b/render.yaml index ec36bb9..21d1b3a 100644 --- a/render.yaml +++ b/render.yaml @@ -130,9 +130,19 @@ projects: staticPublishPath: out pullRequestPreviewsEnabled: true envVars: - # API URL - set to the backend service's public URL after first deploy + # API URL - auto-injected from the backend service's public URL. + # `fromService` + `envVarKey` pulls Render's auto-injected + # RENDER_EXTERNAL_URL (https://-XXXX.onrender.com), resolved + # at build time before this static site builds — so NEXT_PUBLIC_API_URL + # is baked into the bundle with the real, suffix-included URL (no + # manual post-deploy step, no guessing the -XXXX suffix). This works + # without a cyclic dependency because the backend defaults CORS to + # "*" and does not reference this frontend's URL (one-directional). - key: NEXT_PUBLIC_API_URL - sync: false + fromService: + name: pydantic-agents-workflows-api + type: web + envVarKey: RENDER_EXTERNAL_URL routes: - type: rewrite source: /*