Skip to content

[BUG] Incorrect url validation (DATABASE_URL, REDIS_URL) #499

Closed

Description

@SuvorovAM

If the name of the container contains the name of the protocol, then a validation error occurs.

Error messages:

...
The Environment variables has failed the following validations:
{"isUrl":"DATABASE_URL must be a valid postgres connection string"}
{"isUrl":"REDIS_URL must be a valid redis connection string"}
Please fix the environment variables and try again. Exiting program...
...

docker-compose.yml

services:
  project-docmost_app:
    image: docmost/docmost:0.5.0
    container_name: project-docmost_app
    environment:
      DATABASE_URL: "postgresql://app:pass@project-docmost_postgres:5432/app?schema=public"
      REDIS_URL: "redis://project-docmost_redis:6379"
    ...


  project-docmost_postgres:
    image: postgres:16-alpine
    container_name: project-docmost_postgres
    ...
  
  project-docmost_redis:
    image: redis:7.2-alpine
    container_name: project-docmost_redis
    ...

Upd:
The error appears if there is a _ character in the connection string

Warning

      DATABASE_URL: "postgresql://app:pass@project-docmost_postgres:5432/app?schema=public"
      REDIS_URL: "redis://project-docmost_redis:6379"

Tip

      DATABASE_URL: "postgresql://app:pass@project-docmost-postgres:5432/app?schema=public"
      REDIS_URL: "redis://project-docmost-redis:6379"

Upd 2:
The error appears if there is a ? character in postgres password in the connection string

Activity

  1. Philipinho commented on Nov 27, 2024

    @Philipinho
    Member

    Thanks for the updating with your findings.

    Existing issue: #171.

  2. UAnton commented on Dec 11, 2024

    @UAnton

    Last docker image with bug

  3. Philipinho commented on Dec 11, 2024

    @Philipinho
    Member

    @UAnton, a fix has been merged and will be available in the next release.

  4. Philipinho commented on Dec 12, 2024

    @Philipinho
    Member

    This is now fixed in v0.6.1.

  5. UAnton commented on Dec 14, 2024

    @UAnton

    This is now fixed in v0.6.1.

    root@doc:/opt/docmost# docker logs docmost-docmost-1
    
    > [email protected] start /app
    > pnpm --filter ./apps/server run start:prod
    
    
    > [email protected] start:prod /app/apps/server
    > cross-env NODE_ENV=production node dist/main
    
    The Environment variables has failed the following validations:
    {"isUrl":"DATABASE_URL must be a valid postgres connection string"}
    Please fix the environment variables and try again. Exiting program...
    /app/apps/server:
     ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  [email protected] start:prod: `cross-env NODE_ENV=production node dist/main`
    Exit status 1
     ELIFECYCLE  Command failed with exit code 1.
    
    > [email protected] start /app
    > pnpm --filter ./apps/server run start:prod
    
    
    > [email protected] start:prod /app/apps/server
    > cross-env NODE_ENV=production node dist/main
    
    The Environment variables has failed the following validations:
    {"isUrl":"DATABASE_URL must be a valid postgres connection string"}
    Please fix the environment variables and try again. Exiting program...
    /app/apps/server:
     ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  [email protected] start:prod: `cross-env NODE_ENV=production node dist/main`
    Exit status 1
     ELIFECYCLE  Command failed with exit code 1.
    
    > [email protected] start /app
    > pnpm --filter ./apps/server run start:prod
    
    
    > [email protected] start:prod /app/apps/server
    > cross-env NODE_ENV=production node dist/main
    
  6. Philipinho commented on Dec 14, 2024

    @Philipinho
    Member

    @UAnton can I see the database url format you’re using?

  7. UAnton commented on Mar 19, 2025

    @UAnton

    Hi @Philipinho,
    My mistake. Lost server from string.

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