Skip to content

Empty UTOPIA_MIGRATION_URL env breaks startup: Some("") defeats the database_url fallback #343

Description

@realestate-aistudio

Problem

Fresh deploy via docker compose --profile app up -d (image ghcr.io/deeplethe/utopia:0.1.0-rc5) exits immediately with:

Error: error with configuration: relative URL without a base

Root cause

docker-compose.yml sets:

UTOPIA_MIGRATION_URL: ${UTOPIA_MIGRATION_URL:-}

When the variable is unset, Compose passes an empty string into the container. Figment's Env::prefixed("UTOPIA_") deserializes that as Some("") instead of None, so AppConfig::migration_url() (self.migration_url.as_deref().unwrap_or(&self.database_url)) returns "" and the fallback to database_url never fires. sqlx then fails parsing the empty URL.

Verified: setting UTOPIA_MIGRATION_URL explicitly to the same value as UTOPIA_DATABASE_URL makes the app start normally (HTTP 200, migrations run).

Suggested fix

Treat empty as unset, e.g. in migration_url():

self.migration_url.as_deref().filter(|s| !s.trim().is_empty()).unwrap_or(&self.database_url)

(same pattern already used for secret_key empty-string handling in main.rs), or drop the always-empty env line from docker-compose.yml.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions