#Cannot connect to deployment

12 messages · Page 1 of 1 (latest)

cosmic root
flat wigeonBOT
#

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:

  1. Check your environment variables
    Make sure your .env.local (or .env) file contains a valid CONVEX_DEPLOYMENT variable. It should look like:

    CONVEX_DEPLOYMENT=dev:your-deployment-name
    

    or, for production:

    CONVEX_DEPLOYMENT=prod:your-deployment-name
    

    Replace your-deployment-name with the actual name of your deployment, which you can find in the Convex dashboard.

  2. No extra slashes or spaces
    Ensure there are no leading/trailing spaces or extra slashes in the value. For example, a value like dev:my-app (with a space) or dev://my-app will 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].

  3. How was the project set up?
    If you haven’t run npx convex dev successfully before, or if you set up the project manually, try running:

    npx convex dev --configure
    

    This will guide you through connecting your local project to the correct Convex deployment and update your .env.local file accordingly [Error when trying to run convex dev].

#
  1. Check for typos in variable names
    Make sure you’re not using CONVEX_DEPLOY_KEY or other unrelated variables for development. For dev deployments, you typically only need CONVEX_DEPLOYMENT set [npx convex dev problem].

  2. Restart your dev process
    After correcting your environment variables, restart your terminal and run bun convex dev again.

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.

cosmic root
#

@flat wigeon Not sure if it matters but I changed teh folder name of this project?

flat wigeonBOT
#

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.

cosmic root
#

@flat wigeon I didn't change the Convex folder name. I mean root folder

flat wigeonBOT
#

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.

If you continue to see errors, double-check your current working directory with pwd and ensure you are running Convex commands from the correct project root. If the problem persists, please provide more details about your new folder structure and any error messages you see.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: