Ruben
Ruben8mo ago

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?
6 Replies
Ruben
RubenOP8mo ago
I've also dug around in the code and it seems to originate from the following code:
const data = await bigBrainAPI({
ctx,
method: "POST",
url: "claim_preview_deployment",
data: {
projectSelection: await projectSelection(
ctx,
await getConfiguredDeploymentName(ctx),
options.configuredDeployKey,
),
identifier: previewName,
},
});
const data = await bigBrainAPI({
ctx,
method: "POST",
url: "claim_preview_deployment",
data: {
projectSelection: await projectSelection(
ctx,
await getConfiguredDeploymentName(ctx),
options.configuredDeployKey,
),
identifier: previewName,
},
});
https://github.com/get-convex/convex-backend/blob/af95bf5446618a9d9be82a320b64091e947d8dd6/npm-packages/convex/src/cli/deploy.ts#L204 But going through the calls that it's making it seems fine deducing the product name etc... from preview key
GitHub
convex-backend/npm-packages/convex/src/cli/deploy.ts at af95bf54466...
Open source single-machine version of the Convex backend - get-convex/convex-backend
Michal Srb
Michal Srb8mo ago
Hmm, I cannot reproduce this. Can you reproduce it from your terminal? You can run
CONVEX_DEPLOY_KEY="preview...." npx convex deploy --preview-create TEST
CONVEX_DEPLOY_KEY="preview...." npx convex deploy --preview-create TEST
Ruben
RubenOP8mo ago
Thanks for the quick response, and locally it does work. However in the vercel deploy I still receive the same error. Is there something I can do to get some additional logs?
sshader
sshader8mo ago
Some other things to check -- is CONVEX_DEPLOY_KEY configured to that same value for the preview environment in Vercel? If you echo it in your build command does it print what you expect? If you change your build command temporarily to npx convex deploy --preview-create TEST (which worked locally), what happens in Vercel? There's a --verbose flag to npx convex deploy but it might not actually give us a ton more information
Ruben
RubenOP8mo ago
Yes I've tried --preview-create TEST this one but to no avail. Echoing CONVEX_DEPLOY_KEY prints the expected value I can provide my project name and org name so perhaps you can see something in the logs? Now I'm just running the following for a simplified test: npx convex deploy --preview-create TEST-321 but still receiving the error, but only in vercel, locally it works
sshader
sshader8mo ago
Sharing the project + team names (the prefix of your preview deploy key) with us would be helpful (feel free to share over DM)

Did you find this page helpful?