bracket icon indicating copy to clipboard operation
bracket copied to clipboard

Unable to log in and complete lack of log output

Open tschaerni opened this issue 6 months ago • 9 comments

I tried to set bracket up via docker, according to the documentation. And tried logging in with the admin user, specified in the environment variables, it fails with an internal server error on the webpage, but no log output.

Version used: 2.2.3 (latest as of writing)

Note: different external port for the frontend, as that port is already in use by something else

services:
  bracket-frontend:
    image: ghcr.io/evroon/bracket-frontend
    container_name: bracket-frontend
    ports:
      - 3005:3000
    environment:
      NODE_ENV: production
      NEXT_PUBLIC_API_BASE_URL: http://bracket.example.com:8400
      #NEXT_PUBLIC_HCAPTCHA_SITE_KEY: 10000000-ffff-ffff-ffff-000000000001
    restart: unless-stopped
  bracket-backend:
    image: ghcr.io/evroon/bracket-backend
    container_name: bracket-backend
    ports:
      - 8400:8400
    environment:
      ENVIRONMENT: PRODUCTION
      PG_DSN: postgresql://bracket_prod:bracket_prod@postgres:5432/bracket_prod
      CORS_ORIGINS: https://bracket.example.com
      JWT_SECRET: somesecret
      ADMIN_EMAIL: [email protected]
      ADMIN_PASSWORD: somesecurepassword
      AUTO_RUN_MIGRATIONS: true
      ALLOW_USER_REGISTRATION: true
    volumes:
      - ./backend/static:/app/static
    restart: unless-stopped
    depends_on:
      - postgres
  postgres:
    image: postgres
    restart: always
    environment:
      POSTGRES_DB: bracket_prod
      POSTGRES_USER: bracket_prod
      POSTGRES_PASSWORD: bracket_prod
    volumes:
      - ./postgres:/var/lib/postgresql/data

The docker log output says:

postgres-1        | 2025-06-16 10:33:46.349 UTC [1] LOG:  starting PostgreSQL 17.5 (Debian 17.5-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
postgres-1        | 2025-06-16 10:33:46.349 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgres-1        | 2025-06-16 10:33:46.349 UTC [1] LOG:  listening on IPv6 address "::", port 5432
postgres-1        | 2025-06-16 10:33:46.368 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres-1        | 2025-06-16 10:33:46.384 UTC [29] LOG:  database system was shut down at 2025-06-16 10:33:44 UTC
postgres-1        | 2025-06-16 10:33:46.397 UTC [1] LOG:  database system is ready to accept connections
bracket-backend   | [2025-06-16 10:33:47 +0000] [1] [INFO] Starting gunicorn 23.0.0
bracket-backend   | [2025-06-16 10:33:47 +0000] [1] [INFO] Listening at: http://0.0.0.0:8400 (1)
bracket-backend   | [2025-06-16 10:33:47 +0000] [1] [INFO] Using worker: uvicorn.workers.UvicornWorker
bracket-backend   | [2025-06-16 10:33:47 +0000] [8] [INFO] Booting worker with pid: 8
bracket-backend   | [2025-06-16 10:33:48,209] [bracket] [INFO] Current env: PRODUCTION
bracket-backend   | [2025-06-16 10:33:49 +0000] [8] [INFO] Started server process [8]
bracket-backend   | [2025-06-16 10:33:49 +0000] [8] [INFO] Waiting for application startup.
bracket-backend   | [2025-06-16 10:33:49,686] [bracket] [INFO] Running migrations
bracket-backend   | [2025-06-16 10:33:49 +0000] [8] [INFO] Application startup complete.
bracket-frontend  | Starting Nextjs
bracket-frontend  | yarn run v1.22.22
bracket-frontend  | $ next start
bracket-frontend  |    ▲ Next.js 15.3.0
bracket-frontend  |    - Local:        http://localhost:3000
bracket-frontend  |    - Network:      http://192.168.0.2:3000
bracket-frontend  | 
bracket-frontend  |  ✓ Starting...
bracket-frontend  |  ✓ Ready in 913ms

Also: the front and backend seem to be unhealthy, but nothing in the docker logs, and there aren't any logfiles created by the containers as far as I'm aware.

Any clue on how to debug that?

tschaerni avatar Jun 16 '25 10:06 tschaerni

I've got the same problem. can't get it to run

GitHub-gurke34 avatar Jun 19 '25 20:06 GitHub-gurke34

Same here

kinouzero avatar Jul 16 '25 00:07 kinouzero

Unfortunately, same here. I noticed my browser console shows "http://bracket-backend:8400/token net::ERR_NAME_NOT_RESOLVED" which leads me to believe the front end isn't using the defined variable NEXT_PUBLIC_API_BASE_URL.

Any ideas on how to get this to work?

motermouth15 avatar Jul 17 '25 00:07 motermouth15

Unfortunately, same here. I noticed my browser console shows "http://bracket-backend:8400/token net::ERR_NAME_NOT_RESOLVED" which leads me to believe the front end isn't using the defined variable NEXT_PUBLIC_API_BASE_URL.

Any ideas on how to get this to work?

Same problem. I changed NEXT_PUBLIC_API_BASE_UR. Still the output says http://bracket-backend:8400/token in browser

mathyvds avatar Jul 19 '25 12:07 mathyvds

Same problem, including the unhealthy tag in Docker/Portainer

matthewfeury avatar Jul 22 '25 05:07 matthewfeury

Same issue here. @evroon Is this project still in development?

mariushosting avatar Jul 29 '25 19:07 mariushosting

When I removed my browser cache it worked for me. I used a custom https:// domain

Also set up the following env variables in the bracket backend container: ADMIN_EMAIL ADMIN_PASSWORD

mathyvds avatar Jul 29 '25 21:07 mathyvds

I don't really have time currently to do troubleshooting. If the problem is with NEXT_PUBLIC_API_BASE_URL, you could consider building the Docker frontend image yourself, then the environment variable should be set correctly in any case.

evroon avatar Jul 30 '25 07:07 evroon

I got the same problem and to me it looks like using the "NEXT_PUBLIC_API_BASE_URL" not correctly somewhere inside the code generating the .next files is leading to this problem.

When not set / used correctly NEXT_PUBLIC_API_BASE_URL will be set to http://localhost:8400 in two files, which is causing the problems for me that the backend isn't reachable to authenticate the user credentials as the browser will try to reach http://localhost:8400

These are the two files and parts where http://localhost:8400 is set in case NEXT_PUBLIC_API_BASE_URL is NULL

/app/.next/cache/webpack/server-production/0.pack

return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';

/app/.next/cache/webpack/client-production/0.pack

return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';
return process.env.NEXT_PUBLIC_API_BASE_URL != null ? process.env.NEXT_PUBLIC_API_BASE_URL : 'http://localhost:8400';

I can temporarly fix this with running the following command inside the frontend container: find /app/.next/ public -type f | while read file; do sed -i 's|http://localhost:8400|http://<REAL-IP>|g' $file || true; done

I hope this helps to find the root cause and fix this.

SilverHunter1st avatar Aug 10 '25 18:08 SilverHunter1st