Ruben
Ruben
CCConvex Community
Created by Ruben on 9/30/2024 in #support-community
Preview deployment fails with: '✖ Please set CONVEX_DEPLOY_KEY to a new key which you can [...]'
Since last week I'm unable to make preview deployments for my Vercel app. The deployment is able to deploy all convex functions and even prints: Ran "npm run build" with environment variable "NEXT_PUBLIC_CONVEX_URL" set. However after logging ✔ Deployed Convex functions to https:[...].convex.cloud it errors with the following error message: ✖ Please set CONVEX_DEPLOY_KEY to a new key which you can find on your Convex dashboard. Which seems odd as the functions itself have been successfully been deployed so it would seem the CONVEX_DEPLOY_KEY is valid. This error seems to originate from here: https://github.com/get-convex/convex-backend/blob/aef1e1bd991d0aa46e530f3dfc88a4e8335aca7d/npm-packages/convex/src/cli/lib/deployment.ts#L181 A small snippet from the copied github link:
export async function deploymentNameFromAdminKeyOrCrash(
ctx: Context,
adminKey: string,
) {
const deploymentName = deploymentNameFromAdminKey(adminKey);
if (deploymentName === null) {
return await ctx.crash({
exitCode: 1,
errorType: "fatal",
printedMessage: `Please set ${CONVEX_DEPLOY_KEY_ENV_VAR_NAME} to a new key which you can find on your Convex dashboard.`,
});
}
return deploymentName;
}

function deploymentNameFromAdminKey(adminKey: string) {
const parts = adminKey.split("|");
if (parts.length === 1) {
return null;
}
if (isPreviewDeployKey(adminKey)) {
// Preview deploy keys do not contain a deployment name.
return null;
}
return stripDeploymentTypePrefix(parts[0]);
}
export async function deploymentNameFromAdminKeyOrCrash(
ctx: Context,
adminKey: string,
) {
const deploymentName = deploymentNameFromAdminKey(adminKey);
if (deploymentName === null) {
return await ctx.crash({
exitCode: 1,
errorType: "fatal",
printedMessage: `Please set ${CONVEX_DEPLOY_KEY_ENV_VAR_NAME} to a new key which you can find on your Convex dashboard.`,
});
}
return deploymentName;
}

function deploymentNameFromAdminKey(adminKey: string) {
const parts = adminKey.split("|");
if (parts.length === 1) {
return null;
}
if (isPreviewDeployKey(adminKey)) {
// Preview deploy keys do not contain a deployment name.
return null;
}
return stripDeploymentTypePrefix(parts[0]);
}
Here deploymentNameFromAdminKeyOrCrash will throw the specified error when it's called with preview adminKey, which it probably does because this is a preview deployment. Hopefully someone can help us out!
13 replies
CCConvex Community
Created by Ruben on 5/22/2024 in #support-community
Getting an error when trying to deploy a convex preview environment
I've followed the following docs 'https://docs.convex.dev/production/hosting/vercel' which work great for the production deploy, but I receive an error when deploying to a preview environment. I'm using Vercel as a hosting provider and am running the latest versions of convex with node 20. I'm receiving the following error message:
Running "npx convex deploy --cmd 'npm run build'"
Error fetching POST https://provision.convex.dev/api/claim_preview_deployment 404 Not Found: ProjectNotFound: The requested project does not exist: https://provision.convex.dev/api/claim_preview_deployment
Error: Command "npx convex deploy --cmd 'npm run build'" exited with 1
Running "npx convex deploy --cmd 'npm run build'"
Error fetching POST https://provision.convex.dev/api/claim_preview_deployment 404 Not Found: ProjectNotFound: The requested project does not exist: https://provision.convex.dev/api/claim_preview_deployment
Error: Command "npx convex deploy --cmd 'npm run build'" exited with 1
The first part of my CONVEX_DEPLOY_KEY environment variable is: preview:[org-name]:[proj-name]|01xyz.... Do you guys know what might be the issue?
9 replies