Skip to content

write preview env vars to both non-prod netlify contexts#50

Open
michaelfward wants to merge 1 commit into
mainfrom
michael/preview-env-both-contexts
Open

write preview env vars to both non-prod netlify contexts#50
michaelfward wants to merge 1 commit into
mainfrom
michael/preview-env-both-contexts

Conversation

@michaelfward

Copy link
Copy Markdown
Contributor

every preview deployed today is broken: all functions 502 with "No database connection string was provided to neon()". pr-48 and pr-49's previews both hit it; pr-33 and pr-34 (deployed 2026-07-02) still work. nothing relevant changed in the repo between those dates - netlify changed which non-production context a CLI alias deploy's functions bake.

deploy-ci writes preview runtime env (per-PR DATABASE_URL etc) to the branch-deploy context because that's what alias deploys empirically read (verified 2026-06-26; deploy-preview values were invisible then). as of today alias deploys no longer see branch-deploy values, so the deployed functions get no DATABASE_URL at all and crash at module init.

fix: write preview values to BOTH non-prod contexts (deploy-preview + branch-deploy) in the same PUT, so whichever one netlify bakes, the value is there. production path unchanged; production values and scopes still preserved.

test plan

  • npx tsc --noEmit + eslint clean on the changed file
  • after merge: rerun any PR's preview deploy, confirm /api/guidance returns 401 (executing, DB connected) instead of 502

@replay-qa

replay-qa Bot commented Jul 6, 2026

Copy link
Copy Markdown

Replay QA

✅ QA run passed for b65f11dee6f0 (michael/preview-env-both-contexts) — no bugs found.

Bugs found Journeys added Journeys updated Journeys removed
0 0 0 0

Full report in Replay QA →

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

🔎 Loop QA preview (all-k8s backend): https://pr-50--loop-qa-j63k5x.netlify.app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant