appsmithorg/appsmith · critical · Error

Database URL not found. Please check APPSMITH_DB_URL or APPS

Error message

Database URL not found. Please check APPSMITH_DB_URL or APPSMITH_MONGODB_URI configuration.

What it means

Thrown by run() in enable_form_login.ts when utils.getDburl() returns falsy. getDburl() is expected to read APPSMITH_DB_URL or APPSMITH_MONGODB_URI; without a MongoDB connection string the script cannot run mongosh to toggle form login on the default organization, so it aborts up front.

Source

Thrown at app/client/packages/rts/src/ctl/enable_form_login.ts:9

import * as utils from "./utils";

export async function run() {
  const dbUrl = utils.getDburl();
  const redisUrl = utils.getRedisUrl();

  // Validate required configuration
  if (!dbUrl) {
    throw new Error(
      "Database URL not found. Please check APPSMITH_DB_URL or APPSMITH_MONGODB_URI configuration.",
    );
  }

  if (!redisUrl) {
    throw new Error(
      "Redis URL not found. Please check APPSMITH_REDIS_URL configuration.",
    );
  }

  await utils.ensureSupervisorIsRunning();

  let organizationId: string;

  try {
    // First, check if the organization exists
    const orgCheckResult = await utils.execCommandReturningOutput([
      "mongosh",

View on GitHub (pinned to 8cd9021c24)

Solutions

  1. Set APPSMITH_DB_URL (or APPSMITH_MONGODB_URI) to a valid MongoDB URI before running the ctl.
  2. Source the runtime env first: '. /appsmith-stacks/runtime.env' inside the container shell, then re-run.
  3. Confirm the var is exported in the shell with 'echo $APPSMITH_DB_URL' (prints the name only, never log the value).
  4. Verify utils.getDburl() actually reads the var name you set — check for a rename in your Appsmith version.

Example fix

# before
$ appsmith ctl enable-form-login
# -> Database URL not found...

# after
$ export APPSMITH_DB_URL='mongodb://...'
$ appsmith ctl enable-form-login
Defensive patterns

Strategy: validation

Validate before calling

const dbUrl = process.env.APPSMITH_DB_URL || process.env.APPSMITH_MONGODB_URI;
if (!dbUrl) throw new Error('Set APPSMITH_DB_URL or APPSMITH_MONGODB_URI before running the ctl.');

Type guard

const hasDbUrl = (env: NodeJS.ProcessEnv): boolean =>
  Boolean(env.APPSMITH_DB_URL || env.APPSMITH_MONGODB_URI);

Prevention

When it happens

Trigger: Running 'appsmith ctl enable-form-login' (or equivalent) in a container/shell where neither APPSMITH_DB_URL nor APPSMITH_MONGODB_URI is set, or where getDburl() returns undefined because the underlying reader has no fallback.

Common situations: Running the ctl in a one-off 'docker exec' shell that does not load /appsmith-stacks/runtime.env; env var renamed between Appsmith versions; fresh install where the bootstrap env has not been written; misconfigured stack.env.

Related errors


AI-assisted analysis of appsmithorg/appsmith@8cd9021c24 (2026-08-12). Data as JSON: /api/errors/e72cbfc484c8d7b6. Report an issue: GitHub.