#Env variable CONVEX_SELF_HOSTED_URL indicates a self-hosted deployment, which is incompatible with c

1 messages · Page 1 of 1 (latest)

rigid brookBOT
#

Hi @grand cargo. 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—"Env variable CONVEX_SELF_HOSTED_URL indicates a self-hosted deployment, which is incompatible with cloud-hosted env variable CONVEX_DEPLOYMENT. Remove one of them before running the command again."—is expected behavior when both self-hosted and cloud deployment environment variables are present in your environment, even if they're in different files.

Convex CLI does not allow mixing self-hosted and cloud deployment environment variables in the same environment, to prevent accidental deployments to the wrong backend. Specifically, if both CONVEX_SELF_HOSTED_URL (for self-hosted) and CONVEX_DEPLOYMENT (for cloud) are set in your environment (regardless of which file they're in), the CLI will refuse to proceed and ask you to remove one of them before running the command again. This is a safety feature to avoid confusion and potential data loss or misconfiguration Self-hosting with Convex: Everything You Need to Know.

How to resolve:

  • Before running npx convex deploy --env-file .env.prod, make sure that only the relevant environment variables for your target deployment are present in your environment.
  • If you are deploying to a self-hosted backend, ensure that CONVEX_SELF_HOSTED_URL and CONVEX_SELF_HOSTED_ADMIN_KEY are set, and that CONVEX_DEPLOYMENT is not present in any loaded environment file.
  • If you are deploying to the cloud, ensure that CONVEX_DEPLOYMENT (and possibly CONVEX_DEPLOY_KEY for CI) is set, and that CONVEX_SELF_HOSTED_URL is not present.
#

Even if CONVEX_DEPLOYMENT is only in .env.local, if your environment loads both .env.local and .env.prod (or if your shell has both variables set), the CLI will detect both and throw this error. You may need to temporarily remove or rename .env.local, or ensure your environment only loads the intended file for the deployment you are running.

This behavior is confirmed in the official documentation and guides for self-hosting and environment variable management in Convex Self-hosting with Convex: Everything You Need to Know.

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

#

@grand cargo Kapa.ai is still learning and improving, please let me know how I did by reacting below.

grand cargo
#

ok so what they suggest to do, is not reccomented to have development in cloud and production in delf hosting?

#

@rigid brook ok so what they suggest to do, is not reccomented to have development in cloud and production in delf hosting?

rigid brookBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

Based on the knowledge sources, it is technically possible to have development in the cloud and production as self-hosted, but it is not the most common or directly recommended workflow. The documentation and support threads focus on keeping environments (dev, staging, prod) consistent—either all in the cloud or all self-hosted—mainly to avoid confusion and configuration errors. The Convex CLI enforces this separation by not allowing both cloud and self-hosted environment variables to be present at the same time, precisely to prevent accidental cross-deployment issues Self-hosting with Convex: Everything You Need to Know.

If you choose to have cloud dev and self-hosted prod, you must be careful to keep your environment variables and deployment scripts strictly separated, as mixing them will cause errors and is not supported by the CLI. The documentation does not explicitly discourage this setup, but it does not provide guidance or best practices for it either, suggesting it is not the primary intended workflow.

In summary:

  • It is possible, but not directly recommended or documented as a best practice.
  • You must ensure strict separation of environment variables and deployment processes to avoid errors.
  • The CLI is designed to prevent accidental mixing of cloud and self-hosted deployments for safety.

If you need more flexibility or want to avoid this complexity, consider keeping both dev and prod in the same hosting environment (either both cloud or both self-hosted) Self-hosting with Convex: Everything You Need to Know.

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

#

@grand cargo Kapa.ai is still learning and improving, please let me know how I did by reacting below.

grand cargo
rigid brookBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

The error message:

✖ Error fetching POST  <https://complai-convex-backend.fly.dev/api/deploy2/start_push> 500 Internal Server Error: InternalServerError: Your request couldn't be completed. Try again later.

indicates that the Convex backend is returning a 500 Internal Server Error when you attempt to deploy. This is a generic server-side error and can be caused by several issues. Based on the knowledge sources, here are some possible causes and troubleshooting steps:

  1. Temporary Server Issue:
    Sometimes, this error can be due to a temporary issue with the backend server. In some cases, users have reported that the error resolved itself after a few minutes without any changes. If you haven't already, try waiting a bit and running the command again (Discord: Your request couldn't be completed. Try again later).

  2. Network or Routing Issues:
    Network problems, VPNs, or firewalls can sometimes cause this error. Make sure you are not behind a VPN or firewall that could be blocking requests. Also, confirm that your backend is running and accessible at the specified URL (Discord: Your request couldn't be completed. Try again later).

  3. Backend Health:
    Ensure your self-hosted Convex backend is running correctly. If you are using Docker or Fly.io, check the logs for any errors or crashes. Restarting the backend may help if it is in a bad state (Self-hosted README).

#
  1. Environment Variables:
    Double-check that your .env.prod file contains only the self-hosted environment variables (CONVEX_SELF_HOSTED_URL, CONVEX_SELF_HOSTED_ADMIN_KEY) and does not include any cloud-specific variables like CONVEX_DEPLOYMENT. Mixing these can cause errors (Self-hosting with Convex: Everything You Need to Know).

  2. Backend Version or Migrations:
    If you recently updated your backend, make sure all required database migrations have been applied. Failing to do so can cause internal errors (Self-hosted: Voilà!).

If none of these steps resolve the issue, check your backend logs for more detailed error messages, as the 500 error is generic and the root cause will likely be in the server logs.

If you continue to have trouble, consider reaching out on the Convex Discord in the #self-hosted channel for more targeted support, as suggested in the documentation (Self-hosted README).

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

#

@grand cargo Kapa.ai is still learning and improving, please let me know how I did by reacting below.

grand cargo
rigid brookBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

I'm sorry, but you haven't provided the logs yet. Please paste the relevant logs you are seeing from your Convex backend or deployment process, and I'll do my best to help you interpret them or troubleshoot the issue based on the available knowledge sources.

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

#

@grand cargo Kapa.ai is still learning and improving, please let me know how I did by reacting below.

grand cargo
rigid brookBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

I'm sorry, but I do not see the contents of "message.txt" in your previous messages. To help you troubleshoot your Convex deployment issue, please paste the relevant log output directly into the chat. Once you provide the log details, I can review them and offer guidance based on the available knowledge sources.

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

#

@grand cargo Kapa.ai is still learning and improving, please let me know how I did by reacting below.

grand cargo
rigid brookBOT
#

Let me check the knowledge base for you again. One moment! :books: