#Cannot connect to deployment
12 messages · Page 1 of 1 (latest)
Hi @cosmic root. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
The error message you’re seeing:
Error fetching GET <https://api.convex.dev/api/deployment///DEPLOYMENTNAME.convex.cloud/team_and_project> 404 Not Found
suggests that the Convex CLI is not receiving the correct deployment name. The triple slashes (///) and the placeholder DEPLOYMENTNAME indicate that the environment variable for your deployment is either missing or incorrectly set.
Here’s how you can troubleshoot and resolve this:
-
Check your environment variables
Make sure your.env.local(or.env) file contains a validCONVEX_DEPLOYMENTvariable. It should look like:CONVEX_DEPLOYMENT=dev:your-deployment-nameor, for production:
CONVEX_DEPLOYMENT=prod:your-deployment-nameReplace
your-deployment-namewith the actual name of your deployment, which you can find in the Convex dashboard. -
No extra slashes or spaces
Ensure there are no leading/trailing spaces or extra slashes in the value. For example, a value likedev:my-app(with a space) ordev://my-appwill cause issues. This has been a common source of errors, as seen in similar support threads where a space or incorrect value led to a 400 or 404 error from the API [InvalidDeploymentName]. -
How was the project set up?
If you haven’t runnpx convex devsuccessfully before, or if you set up the project manually, try running:npx convex dev --configureThis will guide you through connecting your local project to the correct Convex deployment and update your
.env.localfile accordingly [Error when trying to run convex dev].
-
Check for typos in variable names
Make sure you’re not usingCONVEX_DEPLOY_KEYor other unrelated variables for development. For dev deployments, you typically only needCONVEX_DEPLOYMENTset [npx convex dev problem]. -
Restart your dev process
After correcting your environment variables, restart your terminal and runbun convex devagain.
If you follow these steps and still see the error, please double-check the exact value of CONVEX_DEPLOYMENT in your environment file and ensure it matches the expected format. If possible, paste the relevant line here (redacting any sensitive info) for further help.
Let me know if you need more guidance!
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@cosmic root Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@flat wigeon Not sure if it matters but I changed teh folder name of this project?
Let me check the knowledge base for you again. One moment! :books:
Yes, changing the folder name or location of your Convex functions does matter, and you need to update your project configuration to reflect this change. Specifically, you should set the correct path in your convex.json file using the functions field. For example, if you moved your Convex functions to src/convex/, your convex.json should look like:
{
"functions": "src/convex/"
}
This tells Convex where to find your backend functions. If this is not set correctly, the CLI may not be able to locate your functions, which can lead to errors when running commands like convex dev or deploying your project. More details can be found in the documentation about changing the convex folder name or location.
If you have already updated the folder name but not the convex.json, please update it and try running your command again. If the issue persists, double-check that the path is correct and matches your project structure.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@cosmic root Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@flat wigeon I didn't change the Convex folder name. I mean root folder
Let me check the knowledge base for you again. One moment! :books:
Thank you for clarifying that you changed the root folder of your project, not the Convex functions folder.
Based on the knowledge sources, changing the root folder of your project (for example, moving your entire project directory or renaming it) should not directly affect Convex, as long as the relative paths inside your project remain consistent and your environment variables (like CONVEX_DEPLOYMENT) are still correctly set. However, if you move files or change directory structures, you may need to re-run setup commands or ensure you are running commands from the correct directory.
There is a relevant discussion where a user moved files up a directory and encountered issues, which were resolved by running npx convex dev again in the new directory. This suggests that after moving your project or changing the root folder, you should re-run npx convex dev from the new root to ensure everything is set up correctly. If you have a .env.local file, make sure it is also in the correct location relative to your new project root, as Convex will look for it there for environment variables like CONVEX_DEPLOYMENT Typescript errors on Vite Quickstart.