Repository navigation
Hotfix: move proxy test out of src/pages (Pages build fail) - #62
Merged
Merged
Conversation
Deploying nemar-website with
|
| Latest commit: |
3cbc89f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6b902366.nemar-website.pages.dev |
| Branch Preview URL: | https://feature-hotfix-pages-stop-ro.nemar-website.pages.dev |
neuromechanist
added a commit
that referenced
this pull request
May 26, 2026
CF Pages picks up *.test.ts under src/pages/** as a route entry and breaks the build (same class as PR #62 / commit 3cbc89f for the proxy test). Relocate to src/lib/tree-endpoint.test.ts; the file still imports GET from the route source, so the wire-contract coverage is unchanged. 393/393 tests pass; local astro build completes clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause of the two failed prod deploys
PR #60 added
src/pages/api/v1/proxy.test.tsnext to[...path].ts. Astro treats every.tsfile undersrc/pages/as a route — the test file was being built as/api/v1/proxy.testwith no GET/POST exports. Localbun run buildsilently accepted it as an empty route, but the Cloudflare Pages production build rejected the missing handler exports and failed. That's why the prod deploys for both #60 and #61 failed even though the PR-preview builds and local builds passed.Verified in
dist/_worker.js/index.js: pre-fix had two routes entries —"/api/v1/[...path]"AND"/api/v1/proxy.test". Post-fix only"/api/v1/[...path]"is built.Fix
isSafeProxyPathtosrc/lib/proxy-path.ts(lives alongside other helpers, not in src/pages so Astro can't route to it).src/lib/proxy-path.test.tsand updated the import.src/pages/api/v1/[...path].ts) now importsisSafeProxyPathfrom../../../lib/proxy-path.proxy-path.tsexplaining why the helper has to live in src/lib/ rather than next to the route.Test plan
bun run typecheck— 0 errorsbun run test— 370/370 (same count; the test just moved)bun run build— clean, and verified only/api/v1/[...path]is in the built route table (no/api/v1/proxy.testshadow route)bun run lint— cleancurl https://app.nemar.org/api/v1/datasets?mine=truereturns 401 (proxy reaches backend, no cookie) — the original goal of PR Same-origin /api/v1 proxy for dashboard mutations (#59) #60 + Hotfix: /api/v1 is an app route, not marketing #61.