[GH-ISSUE #1833] Consistent 500 Error on Login with No Backend Logs and Environment Variable Mismatch #529

Closed
opened 2026-02-26 18:47:27 +03:00 by kerem · 3 comments
Owner

Originally created by @limson8 on GitHub (Jun 11, 2025).
Original GitHub issue: https://github.com/documenso/documenso/issues/1833

Issue Description

I am experiencing a persistent 500 Internal Server Error when attempting to log in to my self-hosted Documenso instance. While initial network connection issues were resolved and frontend requests are now correctly routed via Nginx to the custom domain https://sign.yourdomain.com, the login authorize endpoint (/api/auth/email-password/authorize) consistently fails. Crucially, during login attempts, the app Docker container logs (monitored via docker compose logs -f app) show no new output, making backend error diagnosis extremely challenging.

Furthermore, despite updating the .env file and performing full container rebuilds, the ROOT_USER_EMAIL and ROOT_USER_PASSWORD environment variables inside the running app container are not refreshing; they retain their old values, which is suspected to be the root cause.

Steps to Reproduce

/opt/documenso/.env content:

# --- Database Configuration ---
DATABASE_URL="postgresql://documenso_user:YourPostgresDbPassword@db:5432/documenso_db?schema=public"
POSTGRES_USER=documenso_user
POSTGRES_PASSWORD=YourPostgresDbPassword # Placeholder for your actual password
POSTGRES_DB=documenso_db
POSTGRES_HOST=db

# --- Application URLs ---
NEXT_PUBLIC_WEBAPP_URL=https://sign.yourdomain.com
NEXTAUTH_URL=https://sign.yourdomain.com
NEXT_PRIVATE_INTERNAL_WEBAPP_URL=http://app:3000

# --- Email Service (SMTP) ---
# (Currently not configured, left blank)
SMTP_HOST=
SMTP_PORT=
SMTP_USER=
SMTP_PASSWORD=
SMTP_FROM=

# --- JWT Secrets (for security) ---
JWT_SECRET=AStrongRandomJWTSecretStringHere= # Placeholder for a randomly generated string
REFRESH_JWT_SECRET=AnotherStrongRandomJWTSecretStringHere= # Placeholder for another randomly generated string

# --- Initial Admin Account (created on first startup) ---
ROOT_USER_EMAIL=admin@yourdomain.com # Synchronized with manually created DB user
ROOT_USER_PASSWORD=YourAdminPassword!123 # Synchronized with manually created DB user

# --- Database Configuration (Prisma Direct Connection URL) ---
NEXT_PRIVATE_DIRECT_DATABASE_URL="postgresql://documenso_user:YourPostgresDbPassword@db:5432/documenso_db?schema=public"

# --- Database Configuration (Prisma Application Connection URL) ---
NEXT_PRIVATE_DATABASE_URL="postgresql://documenso_user:YourPostgresDbPassword@db:5432/documenso_db?schema=public"

# --- NextAuth Secret ---
NEXTAUTH_SECRET=AStrongRandomNextAuthSecretStringHere= # Placeholder for a randomly generated string

/opt/documenso/docker-compose.yml relevant service configuration:

services:
  db:
    image: postgres:16-alpine
    restart: always
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: ${POSTGRES_DB}
    volumes:
      - db-data:/var/lib/postgresql/data

  app:
    image: documenso/documenso:latest
    restart: always
    ports:
      - "3000:3000"
    env_file:
      - .env
    environment:
      DATABASE_URL: ${DATABASE_URL}
      NEXT_PUBLIC_WEBAPP_URL: ${NEXT_PUBLIC_WEBAPP_URL}
      NEXTAUTH_URL: ${NEXTAUTH_URL}
      NEXT_PRIVATE_INTERNAL_WEBAPP_URL: ${NEXT_PRIVATE_INTERNAL_WEBAPP_URL}
      ROOT_USER_EMAIL: ${ROOT_USER_EMAIL}
      ROOT_USER_PASSWORD: ${ROOT_USER_PASSWORD}
    depends_on:
      - db
    volumes:
      - ./uploads:/app/uploads

volumes:
  db-data:

Expected Behavior

Upon entering correct credentials and clicking "Sign In", I should be successfully authenticated and redirected to the Documenso dashboard.
The authorize API request should return 200 OK.
The app Docker container logs should show successful login attempts or, if an error occurs, provide detailed error messages (stack traces, etc.).

Current Behavior

The browser consistently displays an "Unable to sign in An unknown error occurred" error message after attempting to log in.
The network tab in developer tools shows the POST https://sign.yourdomain.com/api/auth/email-password/authorize request returning a 500 (Internal Server Error).
The browser console shows AppError: Internal Server Error.
Crucially, the docker compose logs -f app command for the Documenso app container remains completely silent during login attempts; no new log entries are generated, even for 500 errors.
The ROOT_USER_EMAIL and ROOT_USER_PASSWORD environment variables inside the running app container do not reflect the latest values from the .env file, sticking to their initial deployment values. This is highly suspected to be the root cause of the 500 error due to a mismatch between the application's perceived admin user and the actual user in the database.

Screenshots (optional)

No response

Operating System [e.g., Windows 10]

Linux

Browser [e.g., Chrome, Firefox]

Chrome

Version [e.g., 2.0.1]

Documenso latest Docker image. Postgres 16-alpine.

Please check the boxes that apply to this issue report.

  • I have searched the existing issues to make sure this is not a duplicate.
  • I have provided steps to reproduce the issue.
  • I have included relevant environment information.
  • I have included any relevant screenshots.
  • I understand that this is a voluntary contribution and that there is no guarantee of resolution.
  • I want to work on creating a PR for this issue if approved
Originally created by @limson8 on GitHub (Jun 11, 2025). Original GitHub issue: https://github.com/documenso/documenso/issues/1833 ### Issue Description I am experiencing a persistent 500 Internal Server Error when attempting to log in to my self-hosted Documenso instance. While initial network connection issues were resolved and frontend requests are now correctly routed via Nginx to the custom domain https://sign.yourdomain.com, the login authorize endpoint (/api/auth/email-password/authorize) consistently fails. Crucially, during login attempts, the app Docker container logs (monitored via docker compose logs -f app) show no new output, making backend error diagnosis extremely challenging. Furthermore, despite updating the .env file and performing full container rebuilds, the ROOT_USER_EMAIL and ROOT_USER_PASSWORD environment variables inside the running app container are not refreshing; they retain their old values, which is suspected to be the root cause. ### Steps to Reproduce **/opt/documenso/.env content:** ``` # --- Database Configuration --- DATABASE_URL="postgresql://documenso_user:YourPostgresDbPassword@db:5432/documenso_db?schema=public" POSTGRES_USER=documenso_user POSTGRES_PASSWORD=YourPostgresDbPassword # Placeholder for your actual password POSTGRES_DB=documenso_db POSTGRES_HOST=db # --- Application URLs --- NEXT_PUBLIC_WEBAPP_URL=https://sign.yourdomain.com NEXTAUTH_URL=https://sign.yourdomain.com NEXT_PRIVATE_INTERNAL_WEBAPP_URL=http://app:3000 # --- Email Service (SMTP) --- # (Currently not configured, left blank) SMTP_HOST= SMTP_PORT= SMTP_USER= SMTP_PASSWORD= SMTP_FROM= # --- JWT Secrets (for security) --- JWT_SECRET=AStrongRandomJWTSecretStringHere= # Placeholder for a randomly generated string REFRESH_JWT_SECRET=AnotherStrongRandomJWTSecretStringHere= # Placeholder for another randomly generated string # --- Initial Admin Account (created on first startup) --- ROOT_USER_EMAIL=admin@yourdomain.com # Synchronized with manually created DB user ROOT_USER_PASSWORD=YourAdminPassword!123 # Synchronized with manually created DB user # --- Database Configuration (Prisma Direct Connection URL) --- NEXT_PRIVATE_DIRECT_DATABASE_URL="postgresql://documenso_user:YourPostgresDbPassword@db:5432/documenso_db?schema=public" # --- Database Configuration (Prisma Application Connection URL) --- NEXT_PRIVATE_DATABASE_URL="postgresql://documenso_user:YourPostgresDbPassword@db:5432/documenso_db?schema=public" # --- NextAuth Secret --- NEXTAUTH_SECRET=AStrongRandomNextAuthSecretStringHere= # Placeholder for a randomly generated string ``` **/opt/documenso/docker-compose.yml relevant service configuration:** ``` services: db: image: postgres:16-alpine restart: always environment: POSTGRES_USER: ${POSTGRES_USER} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_DB: ${POSTGRES_DB} volumes: - db-data:/var/lib/postgresql/data app: image: documenso/documenso:latest restart: always ports: - "3000:3000" env_file: - .env environment: DATABASE_URL: ${DATABASE_URL} NEXT_PUBLIC_WEBAPP_URL: ${NEXT_PUBLIC_WEBAPP_URL} NEXTAUTH_URL: ${NEXTAUTH_URL} NEXT_PRIVATE_INTERNAL_WEBAPP_URL: ${NEXT_PRIVATE_INTERNAL_WEBAPP_URL} ROOT_USER_EMAIL: ${ROOT_USER_EMAIL} ROOT_USER_PASSWORD: ${ROOT_USER_PASSWORD} depends_on: - db volumes: - ./uploads:/app/uploads volumes: db-data: ``` ### Expected Behavior Upon entering correct credentials and clicking "Sign In", I should be successfully authenticated and redirected to the Documenso dashboard. The authorize API request should return 200 OK. The app Docker container logs should show successful login attempts or, if an error occurs, provide detailed error messages (stack traces, etc.). ### Current Behavior The browser consistently displays an "Unable to sign in An unknown error occurred" error message after attempting to log in. The network tab in developer tools shows the POST https://sign.yourdomain.com/api/auth/email-password/authorize request returning a 500 (Internal Server Error). The browser console shows AppError: Internal Server Error. Crucially, the docker compose logs -f app command for the Documenso app container remains completely silent during login attempts; no new log entries are generated, even for 500 errors. The ROOT_USER_EMAIL and ROOT_USER_PASSWORD environment variables inside the running app container do not reflect the latest values from the .env file, sticking to their initial deployment values. This is highly suspected to be the root cause of the 500 error due to a mismatch between the application's perceived admin user and the actual user in the database. ### Screenshots (optional) _No response_ ### Operating System [e.g., Windows 10] Linux ### Browser [e.g., Chrome, Firefox] Chrome ### Version [e.g., 2.0.1] Documenso latest Docker image. Postgres 16-alpine. ### Please check the boxes that apply to this issue report. - [x] I have searched the existing issues to make sure this is not a duplicate. - [x] I have provided steps to reproduce the issue. - [x] I have included relevant environment information. - [ ] I have included any relevant screenshots. - [x] I understand that this is a voluntary contribution and that there is no guarantee of resolution. - [ ] I want to work on creating a PR for this issue if approved
kerem 2026-02-26 18:47:27 +03:00
Author
Owner

@github-actions[bot] commented on GitHub (Jun 11, 2025):

Thank you for opening your first issue and for being a part of the open signing revolution!

One of our team members will review it and get back to you as soon as it possible 💚

Meanwhile, please feel free to hop into our community in Discord

<!-- gh-comment-id:2961355463 --> @github-actions[bot] commented on GitHub (Jun 11, 2025): Thank you for opening your first issue and for being a part of the open signing revolution! <br /> One of our team members will review it and get back to you as soon as it possible 💚 <br /> Meanwhile, please feel free to hop into our community in [Discord](https://documen.so/discord)
Author
Owner

@limson8 commented on GitHub (Jun 11, 2025):

the lastest version i was pulling is not working, i change to 1.11.1 and it sovles the promblem

<!-- gh-comment-id:2962340204 --> @limson8 commented on GitHub (Jun 11, 2025): the lastest version i was pulling is not working, i change to 1.11.1 and it sovles the promblem
Author
Owner

@el3ctrician commented on GitHub (Sep 9, 2025):

i have the same issue shall we use older version ?

Edit could it be related to SMTP not being setup. I am suspecting bad SMTP config

<!-- gh-comment-id:3270202289 --> @el3ctrician commented on GitHub (Sep 9, 2025): i have the same issue shall we use older version ? Edit could it be related to SMTP not being setup. I am suspecting bad SMTP config
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#529
No description provided.