Skip to content

Commit aaca1d9

Browse files
authored
Merge pull request #9 from prazgaitis/fix/preview-convex-site-url
Fix preview build Convex site URL
2 parents db0aba1 + aafe585 commit aaca1d9

3 files changed

Lines changed: 21 additions & 4 deletions

File tree

.claude/napkin.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
## Corrections
44
| Date | Source | What Went Wrong | What To Do Instead |
55
|------|--------|----------------|-------------------|
6+
| 2026-02-11 | self | Ran `ls` before reading napkin (again) | Always read `.claude/napkin.md` before any other command |
7+
| 2026-02-10 | self | Ran `ls` before reading napkin | Always read `.claude/napkin.md` before any other command |
8+
| 2026-02-10 | self | Used backticks in a shell-quoted PR body so the shell tried to execute `turbo` | Use a heredoc or escape backticks when passing PR bodies to shell commands |
69

710
## User Preferences
811
- Hide navbar on full-screen flow pages (invite, dashboard, admin) via `ConditionalHeader` patterns + remove `page-with-header` class
@@ -19,7 +22,7 @@
1922
- `page-with-header` CSS class = `pt-16` to offset fixed navbar
2023
- Seed data lives in `packages/backend/actions/seed.ts`
2124
- Schema changes auto-deploy locally via `pnpm dev`
22-
23-
## Corrections
24-
| 2026-02-10 | self | Ran `ls` before reading napkin | Always read `.claude/napkin.md` before any other command |
25-
| 2026-02-10 | self | Used backticks in a shell-quoted PR body so the shell tried to execute `turbo` | Use a heredoc or escape backticks when passing PR bodies to shell commands |
25+
| 2026-02-11 | self | Set NEXT_PUBLIC_CONVEX_SITE_URL without export, so child process didn't receive it | Use `export` (or VAR=... cmd) when setting env vars for `next build` |
26+
| 2026-02-11 | self | Assumed `CONVEX_URL` would always be set inside `--cmd` but it was empty in Vercel logs | Use `--cmd-url-env-var-name NEXT_PUBLIC_CONVEX_URL` and reference that explicitly; export it for `next build` |
27+
| 2026-02-11 | self | Vercel `buildCommand` schema max length 256 chars | Move long logic into a script and keep `buildCommand` short |
28+
| 2026-02-11 | self | `set -u` caused failure because `$NEXT_PUBLIC_CONVEX_URL` expanded in the outer script, not inside `--cmd` | Escape `$` in the `--cmd` string so it expands in the Convex-invoked shell |

apps/web/next.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
import type { NextConfig } from "next";
22

3+
// Derive NEXT_PUBLIC_CONVEX_SITE_URL from NEXT_PUBLIC_CONVEX_URL if not set.
4+
// The site URL is always the cloud URL with ".convex.cloud" → ".convex.site".
5+
if (!process.env.NEXT_PUBLIC_CONVEX_SITE_URL && process.env.NEXT_PUBLIC_CONVEX_URL) {
6+
process.env.NEXT_PUBLIC_CONVEX_SITE_URL = process.env.NEXT_PUBLIC_CONVEX_URL.replace(
7+
".convex.cloud",
8+
".convex.site"
9+
);
10+
}
11+
312
const nextConfig: NextConfig = {};
413

514
export default nextConfig;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# 2026-02-11: Fix preview deploy missing CONVEX_SITE_URL
2+
3+
- [x] Reproduce and locate the missing env var usage
4+
- [x] Update Vercel build command to set `NEXT_PUBLIC_CONVEX_SITE_URL`
5+
- [x] Summarize the fix and any required deploy env changes

0 commit comments

Comments
 (0)