🐛 fix(deploy): anchor .vercelignore paths so merging to main stops shipping a 404#18
Conversation
…ng a 404 .vercelignore uses .gitignore semantics: a pattern with no leading slash matches at every depth. The bare `src` entry — meant to drop the CLI source at the repo root — also matched `website/src` and `docs-site/src`, so Vercel's git build deleted both Next apps' source before building. `next build` then found no app directory, emitted a lone `/404` route, and production served a 404. This never surfaced because every deploy so far was `vercel deploy --prebuilt`, which uploads the prebuilt output directory and never applies .vercelignore. Merging #17 fired the first git-integration production deploy and took the site down. Anchors every product-internal path with a leading slash. Verified with `git ls-files -i -c -X .vercelignore` (same semantics): 0 files removed from website/ or docs-site/, 525 root internal files still excluded.
The privacy guard asserted the exact unanchored lines (`^candidate$`), which is what forced the bug: anchoring the paths broke it. Assert the anchored form instead — same privacy intent — and add a regression check that the depth-matching bare forms never come back. Verified the new assertion fails against the old .vercelignore.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughUpdated 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
biggest-littlest
left a comment
There was a problem hiding this comment.
Verified the root cause independently: git ls-files -i -c -X .vercelignore on the old file lists website/src/app/page.tsx and docs-site/src/app/[[...slug]]/page.tsx among the removals, and the broken build log has no Route (app) table. The preview build on this branch now shows ┌ ○ /. Test change keeps the privacy intent (anchored /candidate, /.rolester, /workspace) and adds a real regression guard. Ship it.
ALARGECOMPANY
left a comment
There was a problem hiding this comment.
Good root-cause fix rather than turning off deploys.
Merging #17 fired the first Vercel git-integration production deploy this project has ever had. It went green, took the
rolester.codeswhat.comalias, and served a 404. I restored the site by hand with a prebuilt deploy; this fixes the cause so merge-to-main deploys work, which is how this repo is supposed to ship.Root cause
.vercelignoreuses.gitignoresemantics: a pattern with no leading slash matches at every depth. The baresrcentry was meant to drop the CLI source at the repo root. It also matchedwebsite/srcanddocs-site/src.From the broken build log:
No
Route (app)table, for either app. Next found no app directory because Vercel had deleted it, emitted a lone 404 page, exported that, and shipped it. The build never failed — it succeeded at building nothing.15 files were deleted, including
website/src/app/page.tsx,website/src/app/layout.tsx, anddocs-site/src/app/[[...slug]]/page.tsx.Why it stayed hidden
Every prior deploy was
vercel deploy --prebuilt, which uploads the already-built output directory and never applies.vercelignore. The landmine was armed the day the file was written and only went off when a merge tomaintriggered a git build for the first time.The fix
Anchor every product-internal path with a leading slash. The recursive patterns (
node_modules,.next,out,*.tsbuildinfo) stay unanchored on purpose.Verified with
git ls-files -i -c -X .vercelignore, which uses the same semantics:The test change
tests/release-safety.test.mjsasserted the exact unanchored lines (^candidate$,^.rolester$) as its privacy guard — so anchoring the paths broke it. That assertion is what pinned the bug in place. It now asserts the anchored form (same privacy intent:candidate/,.rolester/,workspace/still never reach Vercel) and adds a regression check that the depth-matching bare forms cannot come back.I confirmed the new assertion fails against the old
.vercelignorebefore keeping it, so it is a real guard and not a rubber stamp.Verification
git ls-files -i -c -X .vercelignore→ 0 files removed fromwebsite/ordocs-site/node --test tests/release-safety.test.mjs→ 6/6, and 1 failure when pointed at the old fileRoute (app)table with/rather than a lone/404. Checking that before merge.Note
I am not disabling git deploys. Merge-to-main should deploy — that is the point. This makes it actually work.
🐛 Fixed
.vercelignorewith leading/so root-only paths no longer match nested directories likewebsite/srcordocs-site/src.🔧 Changed
Added
.vercelignoredocumentation clarifying.gitignore-style matching semantics for unanchored patterns.Kept recursive ignore patterns unanchored where depth-wide matching is intended.
Verify any other root-adjacent paths in
.vercelignorestill use the intended matching behavior.Keep the release-safety test aligned with future
.vercelignoreedits to prevent regressions.