Skip to content

fix(web): wire DOCS_PROXY_URL into deployed Worker env#30

Merged
cooper (czxtm) merged 1 commit intomainfrom
claude/fix-prod-loading-SjtHu
May 2, 2026
Merged

fix(web): wire DOCS_PROXY_URL into deployed Worker env#30
cooper (czxtm) merged 1 commit intomainfrom
claude/fix-prod-loading-SjtHu

Conversation

@czxtm
Copy link
Copy Markdown
Contributor

Summary

Every /docs/* link on the marketing page (stackpanel.com) currently returns HTTP 503:

$ curl -s https://stackpanel.com/docs/quick-start
{"error":"DOCS_PROXY_URL environment variable is not configured"}

The proxy route at apps/web/src/routes/docs/$.ts + index.ts reads process.env.DOCS_PROXY_URL and short-circuits with that 503 when the binding is missing.

Root cause: The proxy was added on 2026-04-23 (74fca2e "Make environment variables required by default") but apps/web/alchemy.run.ts was never updated to forward the URL into Cloudflare.Vite({ env }). The recent feat(env): build-time secret injection commit established the env-forwarding pattern for BETTER_AUTH_SECRET + Polar values but didn't include this one. So the binding has been absent on every deploy since the route landed — docs.stackpanel.com itself is healthy, only the apex proxy is broken.

Fix: Derive DOCS_PROXY_URL per stage to mirror hostnameFor in apps/docs/alchemy.run.ts, and forward it through the same Cloudflare.Vite({ env }) block the secrets use:

  • productionhttps://docs.stackpanel.com
  • staginghttps://docs.staging.stackpanel.com
  • everything else (PR previews, dev) → https://docs.stackpanel.com (we don't deploy per-PR docs Workers; serving real content beats 503'ing)

The CI memo-bust from #27 (.build-info stamp) will force a fresh upload on push so this actually reaches the deployed Worker.

Test plan

  • Wait for the deploy-web workflow to finish on this branch
  • curl -sI https://<preview-url>/docs/quick-start returns 200 and the rendered Fumadocs page (not the 503 JSON blob)
  • After merge, verify on prod: curl -sI https://stackpanel.com/docs/quick-start returns 200
  • Click through the Quick start / Why / Changelog / License footer links from stackpanel.com and confirm each renders
  • https://docs.stackpanel.com/... direct hits continue to work unchanged

Generated by Claude Code

Every link on stackpanel.com pointing under `/docs/*` (Quick start, Why
Stackpanel, Changelog, Stacks, License, …) currently returns HTTP 503
with `{"error":"DOCS_PROXY_URL environment variable is not configured"}`.
The proxy route at `apps/web/src/routes/docs/$.ts` + `index.ts` reads
`process.env.DOCS_PROXY_URL` and short-circuits with that 503 when the
binding is missing.

Root cause: the proxy was added on 2026-04-23 (74fca2e "Make environment
variables required by default") but `apps/web/alchemy.run.ts` was never
updated to forward the URL into `Cloudflare.Vite({ env })`. The recent
`feat(env): build-time secret injection` commit established the env-
forwarding pattern for `BETTER_AUTH_SECRET` + Polar values but didn't
include this one. So the binding has been absent on every deploy since
the route landed — the docs site itself (`docs.stackpanel.com`) is
healthy, only the apex proxy is broken.

Fix: derive `DOCS_PROXY_URL` per stage to mirror `hostnameFor` in
`apps/docs/alchemy.run.ts` (production → docs.stackpanel.com,
staging → docs.staging.stackpanel.com), and forward it through the same
`Cloudflare.Vite({ env })` block the secrets use. PR previews and dev
fall back to the production docs site since we don't deploy per-PR
docs workers; serving real content is preferable to 503'ing.

The CI memo-bust from PR #27 (.build-info stamp) will force a fresh
upload on push so this actually reaches the deployed Worker.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

Preview deployed to pr-30https://pr-30.stackpanel.com

@czxtm cooper (czxtm) marked this pull request as ready for review May 2, 2026 13:44
@cursor
Copy link
Copy Markdown

cursor Bot commented May 2, 2026

PR Summary

Low Risk
Low risk: only adds a new environment binding and simple stage-based URL selection; affects request routing for /docs/* but not auth or data handling.

Overview
Fixes broken /docs/* links on the web Worker by deriving a stage-specific docs origin and exporting it as DOCS_PROXY_URL in the Cloudflare.Vite({ env }) deployment config.

production proxies to https://docs.stackpanel.com, staging proxies to https://docs.staging.stackpanel.com, and all other stages fall back to production docs to avoid 503s when a per-preview docs deploy doesn’t exist.

Reviewed by Cursor Bugbot for commit 125f274. Configure here.

@czxtm cooper (czxtm) merged commit 8a4db12 into main May 2, 2026
4 of 5 checks passed
@czxtm cooper (czxtm) deleted the claude/fix-prod-loading-SjtHu branch May 2, 2026 15:46
cooper (czxtm) added a commit that referenced this pull request May 2, 2026
fix(web): wire DOCS_PROXY_URL into deployed Worker env
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.

2 participants