#issue deploying to self hosted convex

4 messages · Page 1 of 1 (latest)

lyric creek
#

When I run bunx convex dev I get

400 Bad Request: BadJsonBody: Failed to deserialize the JSON body into the target type: appDefinition: missing field `functions` at line 1 column 610097
pale epochBOT
#

Hi @lyric creek. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

I’m sorry, but the knowledge sources don’t mention this specific BadJsonBody: appDefinition: missing field "functions" error when deploying to a self‑hosted backend, so I can’t give a definitive root cause.

What I can say from the docs:

  • When using a self‑hosted backend, npx/bunx convex dev talks to the backend whose URL and admin key you configure via:

    CONVEX_SELF_HOSTED_URL='<http://127.0.0.1:3210'>
    CONVEX_SELF_HOSTED_ADMIN_KEY='<your admin key>'
    

    in .env.local (or your environment). [Self-hosted readme; Dev workflow]

  • The CLI then pushes an “app definition” (functions, schema, etc.) to that backend, similar to how it does for the cloud dev deployment. [CLI dev]

The error you’re seeing indicates that the backend is trying to parse that app definition JSON and doesn’t find a required functions field. That suggests a mismatch between:

  • the CLI version you’re running locally, and
  • the version of the self‑hosted backend you’re running in Docker/Fly/etc.

However, the provided docs don’t explicitly document this error or the exact compatibility matrix, so I can’t confirm that with certainty.

Given the limits of the docs, the only concrete, doc‑backed steps I can recommend are:

  1. Ensure you’re on the latest convex NPM package in your app:

    npm install convex@latest
    

    [Self-hosted readme]

#
  1. Ensure your self‑hosted backend is up to date by pulling the latest images / code per the self‑hosting instructions (Docker or Fly). [Self-hosted readme; Self-hosted article]

  2. Double‑check your environment variables: only CONVEX_SELF_HOSTED_URL and CONVEX_SELF_HOSTED_ADMIN_KEY should be set for self‑hosting; don’t mix them with cloud CONVEX_DEPLOY_KEY etc. [Dev workflow]

Beyond that, the docs suggest using the #self-hosted channel in Discord or GitHub Issues for self‑hosting problems, which is likely the best next step for this specific backend JSON error. [Self-hosted questions]

Because the knowledge sources don’t describe this exact error, I can’t safely provide more targeted debugging steps without guessing.

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