Fix Vercel integration when publishable client keys are missing

This commit is contained in:
Konstantin Wohlwend 2026-04-08 17:26:50 -07:00
parent a0710f8807
commit 1b3e7f5ba2
2 changed files with 11 additions and 2 deletions

View File

@ -84,9 +84,13 @@ export default function PageClient() {
description: "Vercel Integration",
});
const publishableClientKey = requirePublishableClientKey
? (newKey.publishableClientKey ?? throwErr("Expected publishableClientKey when project.requirePublishableClientKey is true"))
: undefined;
setKeys({
projectId: adminApp.projectId,
publishableClientKey: newKey.publishableClientKey ?? throwErr("Expected publishableClientKey after creating an API key with hasPublishableClientKey: true"),
publishableClientKey,
secretServerKey: newKey.secretServerKey ?? throwErr("Expected secretServerKey after creating an API key with hasSecretServerKey: true"),
});
} finally {
@ -160,7 +164,9 @@ export default function PageClient() {
</div>
) : (
<p className="text-xs text-muted-foreground">
You&apos;ll receive a publishable client key and a secret server key for this project.
{requirePublishableClientKey
? "You&apos;ll receive a publishable client key and a secret server key for this project."
: "You&apos;ll receive a secret server key for this project."}
</p>
),
},

View File

@ -164,3 +164,6 @@ A: Add project-level shortcuts to `PROJECT_SHORTCUTS` in `apps/dashboard/src/com
Q: Which port suffixes are assigned to the two local docs sites?
A: `docs` (old docs app) uses suffix `26`, and `docs-mintlify` uses suffix `04`. Keep these in sync across `docs/package.json`, `docs-mintlify/package.json`, `apps/dev-launchpad/public/index.html`, and `apps/dashboard/.env.development` (`NEXT_PUBLIC_STACK_DOCS_BASE_URL` points to old docs on `26`).
Q: Why did the dashboard Vercel integration throw "Expected publishableClientKey" during key generation?
A: In `apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/vercel/page-client.tsx`, the code always asserted `newKey.publishableClientKey` even when `project.requirePublishableClientKey` was false. Fix by only asserting/passing `publishableClientKey` when that project config flag is true.