Skip to content

Commit aafe585

Browse files
prazgaitisclaude
andcommitted
Derive CONVEX_SITE_URL in next.config.ts instead of shell script
Replace the complex vercel-build.sh with a simple derivation in next.config.ts that converts .convex.cloud to .convex.site at build time. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1b23d15 commit aafe585

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

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;

apps/web/vercel-build.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

vercel.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://openapi.vercel.sh/vercel.json",
3-
"buildCommand": "bash vercel-build.sh",
3+
"buildCommand": "cd ../../packages/backend && npx convex deploy --cmd 'cd ../../apps/web && npx next build' --cmd-url-env-var-name NEXT_PUBLIC_CONVEX_URL",
44
"installCommand": "pnpm install",
55
"framework": "nextjs"
66
}

0 commit comments

Comments
 (0)