Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-compose build failed #1288

Open
linlin-coder opened this issue Jul 22, 2024 · 14 comments · May be fixed by #1303
Open

docker-compose build failed #1288

linlin-coder opened this issue Jul 22, 2024 · 14 comments · May be fixed by #1303
Labels
bug Something isn't working

Comments

@linlin-coder
Copy link

System Info

when i run docker-compose build,some error message as follows:

 => CACHED [client 3/6] COPY package*.json ./                                                                                                           0.0s
 => CACHED [client 4/6] RUN npm config set registry https://registry.npmmirror.com && npm install                                                       0.0s
 => [client 5/6] COPY . .                                                                                                                               0.1s
 => ERROR [client 6/6] RUN npm run build                                                                                                               63.4s
------
 > [client 6/6] RUN npm run build:
0.531 
0.531 > client@0.1.0 build
0.531 > next build
0.531 
1.233 Attention: Next.js now collects completely anonymous telemetry regarding usage.
1.233 This information is used to shape Next.js' roadmap and prioritize features.
1.233 You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
1.234 https://nextjs.org/telemetry
1.234 
1.342   ▲ Next.js 14.2.3
1.343   - Environments: .env
1.345 
1.441    Creating an optimized production build ...
52.48  ✓ Compiled successfully
52.48    Skipping linting
52.48    Checking validity of types ...
59.49    Collecting page data ...
61.94    Generating static pages (0/15) ...
62.24    Generating static pages (3/15) 
62.35 Get request failed TypeError: fetch failed
62.35     at Object.fetch (node:internal/deps/undici/undici:14152:11)
62.35     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
62.35     at async i (/app/build/server/app/(ee)/settings/logs/[id]/page.js:8:36612)
62.35     at async u (/app/build/server/app/(ee)/settings/logs/page.js:46:2873) {
62.35   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
62.35       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
62.35       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
62.35     errno: -111,
62.35     code: 'ECONNREFUSED',
62.35     syscall: 'connect',
62.35     address: '127.0.0.1',
62.35     port: 8000
62.35   }
62.35 }
62.35 TypeError: fetch failed
62.35     at Object.fetch (node:internal/deps/undici/undici:14152:11)
62.35     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
62.35     at async i (/app/build/server/app/(ee)/settings/logs/[id]/page.js:8:36612)
62.35     at async u (/app/build/server/app/(ee)/settings/logs/page.js:46:2873) {
62.35   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
62.35       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
62.35       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
62.35     errno: -111,
62.35     code: 'ECONNREFUSED',
62.35     syscall: 'connect',
62.35     address: '127.0.0.1',
62.35     port: 8000
62.35   },
62.35   digest: '2074752815'
62.35 }
62.35 Get request failed TypeError: fetch failed
62.35     at Object.fetch (node:internal/deps/undici/undici:14152:11)
62.35     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
62.35     at async i (/app/build/server/app/(ee)/settings/logs/[id]/page.js:8:36612)
62.35     at async u (/app/build/server/app/(ee)/settings/logs/page.js:46:2873) {
62.35   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
62.35       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
62.35       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
62.35     errno: -111,
62.35     code: 'ECONNREFUSED',
62.35     syscall: 'connect',
62.35     address: '127.0.0.1',
62.35     port: 8000
62.35   }
62.35 }
62.35 TypeError: fetch failed
62.35     at Object.fetch (node:internal/deps/undici/undici:14152:11)
62.35     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
62.35     at async i (/app/build/server/app/(ee)/settings/logs/[id]/page.js:8:36612)
62.35     at async u (/app/build/server/app/(ee)/settings/logs/page.js:46:2873) {
62.35   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
62.35       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
62.35       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
62.35     errno: -111,
62.35     code: 'ECONNREFUSED',
62.35     syscall: 'connect',
62.35     address: '127.0.0.1',
62.35     port: 8000
62.35   },
62.35   digest: '2074752815'
62.35 }
62.35 
62.35 Error occurred prerendering page "/settings/logs". Read more: https://nextjs.org/docs/messages/prerender-error
62.35 
62.35 TypeError: fetch failed
62.35     at Object.fetch (node:internal/deps/undici/undici:14152:11)
62.35     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
62.35     at async i (/app/build/server/app/(ee)/settings/logs/[id]/page.js:8:36612)
62.35     at async u (/app/build/server/app/(ee)/settings/logs/page.js:46:2873)
62.81    Generating static pages (7/15) 
63.00 Get request failed TypeError: fetch failed
63.00     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.00     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.00     at async n (/app/build/server/app/settings/datasets/[id]/page.js:1:18976)
63.00     at async u (/app/build/server/app/settings/datasets/page.js:1:8848) {
63.00   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
63.00       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
63.00       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
63.00     errno: -111,
63.00     code: 'ECONNREFUSED',
63.00     syscall: 'connect',
63.00     address: '127.0.0.1',
63.00     port: 8000
63.00   }
63.00 }
63.00 TypeError: fetch failed
63.00     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.00     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.00     at async n (/app/build/server/app/settings/datasets/[id]/page.js:1:18976)
63.00     at async u (/app/build/server/app/settings/datasets/page.js:1:8848) {
63.00   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
63.00       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
63.00       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
63.00     errno: -111,
63.00     code: 'ECONNREFUSED',
63.00     syscall: 'connect',
63.00     address: '127.0.0.1',
63.00     port: 8000
63.00   },
63.00   digest: '1717648049'
63.00 }
63.00 Get request failed TypeError: fetch failed
63.00     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.00     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.00     at async n (/app/build/server/app/settings/datasets/[id]/page.js:1:18976)
63.00     at async u (/app/build/server/app/settings/datasets/page.js:1:8848) {
63.00   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
63.00       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
63.00       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
63.00     errno: -111,
63.00     code: 'ECONNREFUSED',
63.00     syscall: 'connect',
63.00     address: '127.0.0.1',
63.00     port: 8000
63.00   }
63.00 }
63.00 TypeError: fetch failed
63.00     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.00     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.00     at async n (/app/build/server/app/settings/datasets/[id]/page.js:1:18976)
63.00     at async u (/app/build/server/app/settings/datasets/page.js:1:8848) {
63.00   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
63.00       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
63.00       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
63.00     errno: -111,
63.00     code: 'ECONNREFUSED',
63.00     syscall: 'connect',
63.00     address: '127.0.0.1',
63.00     port: 8000
63.00   },
63.00   digest: '1717648049'
63.00 }
63.00 
63.00 Error occurred prerendering page "/settings/datasets". Read more: https://nextjs.org/docs/messages/prerender-error
63.00 
63.00 TypeError: fetch failed
63.00     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.00     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.00     at async n (/app/build/server/app/settings/datasets/[id]/page.js:1:18976)
63.00     at async u (/app/build/server/app/settings/datasets/page.js:1:8848)
63.05    Generating static pages (11/15) 
63.10 Get request failed TypeError: fetch failed
63.10     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.10     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.10     at async n (/app/build/server/app/settings/datasets/[id]/page.js:1:18976)
63.10     at async p (/app/build/server/app/settings/workspaces/addspaces/page.js:1:12080) {
63.10   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
63.10       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
63.10       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
63.10     errno: -111,
63.10     code: 'ECONNREFUSED',
63.10     syscall: 'connect',
63.10     address: '127.0.0.1',
63.10     port: 8000
63.10   }
63.10 }
63.10 TypeError: fetch failed
63.10     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.10     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.10     at async n (/app/build/server/app/settings/datasets/[id]/page.js:1:18976)
63.10     at async p (/app/build/server/app/settings/workspaces/addspaces/page.js:1:12080) {
63.10   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
63.10       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
63.10       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
63.10     errno: -111,
63.10     code: 'ECONNREFUSED',
63.10     syscall: 'connect',
63.10     address: '127.0.0.1',
63.10     port: 8000
63.10   },
63.10   digest: '2692158989'
63.10 }
63.10 Get request failed TypeError: fetch failed
63.10     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.10     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.10     at async n (/app/build/server/app/settings/datasets/[id]/page.js:1:18976)
63.10     at async p (/app/build/server/app/settings/workspaces/addspaces/page.js:1:12080) {
63.10   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
63.10       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
63.10       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
63.10     errno: -111,
63.10     code: 'ECONNREFUSED',
63.10     syscall: 'connect',
63.10     address: '127.0.0.1',
63.10     port: 8000
63.10   }
63.10 }
63.10 TypeError: fetch failed
63.10     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.10     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.10     at async n (/app/build/server/app/settings/datasets/[id]/page.js:1:18976)
63.10     at async p (/app/build/server/app/settings/workspaces/addspaces/page.js:1:12080) {
63.10   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
63.10       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
63.10       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
63.10     errno: -111,
63.10     code: 'ECONNREFUSED',
63.10     syscall: 'connect',
63.10     address: '127.0.0.1',
63.10     port: 8000
63.10   },
63.10   digest: '2692158989'
63.10 }
63.10 
63.10 Error occurred prerendering page "/settings/workspaces/addspaces". Read more: https://nextjs.org/docs/messages/prerender-error
63.10 
63.10 TypeError: fetch failed
63.10     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.10     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.10     at async n (/app/build/server/app/settings/datasets/[id]/page.js:1:18976)
63.10     at async p (/app/build/server/app/settings/workspaces/addspaces/page.js:1:12080)
63.17 Get request failed TypeError: fetch failed
63.17     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.17     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.17     at async n (/app/build/server/app/settings/datasets/[id]/page.js:1:18976)
63.17     at async p (/app/build/server/app/settings/workspaces/editspaces/page.js:1:12135) {
63.17   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
63.17       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
63.17       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
63.17     errno: -111,
63.17     code: 'ECONNREFUSED',
63.17     syscall: 'connect',
63.17     address: '127.0.0.1',
63.17     port: 8000
63.17   }
63.17 }
63.17 TypeError: fetch failed
63.17     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.17     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.17     at async n (/app/build/server/app/settings/datasets/[id]/page.js:1:18976)
63.17     at async p (/app/build/server/app/settings/workspaces/editspaces/page.js:1:12135) {
63.17   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
63.17       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
63.17       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
63.17     errno: -111,
63.17     code: 'ECONNREFUSED',
63.17     syscall: 'connect',
63.17     address: '127.0.0.1',
63.17     port: 8000
63.17   },
63.17   digest: '4144802943'
63.17 }
63.17 Get request failed TypeError: fetch failed
63.17     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.17     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.17     at async n (/app/build/server/app/settings/datasets/[id]/page.js:1:18976)
63.17     at async p (/app/build/server/app/settings/workspaces/editspaces/page.js:1:12135) {
63.17   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
63.17       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
63.17       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
63.17     errno: -111,
63.17     code: 'ECONNREFUSED',
63.17     syscall: 'connect',
63.17     address: '127.0.0.1',
63.17     port: 8000
63.17   }
63.17 }
63.17 TypeError: fetch failed
63.17     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.17     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.17     at async n (/app/build/server/app/settings/datasets/[id]/page.js:1:18976)
63.17     at async p (/app/build/server/app/settings/workspaces/editspaces/page.js:1:12135) {
63.17   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
63.17       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
63.17       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
63.17     errno: -111,
63.17     code: 'ECONNREFUSED',
63.17     syscall: 'connect',
63.17     address: '127.0.0.1',
63.17     port: 8000
63.17   },
63.17   digest: '4144802943'
63.17 }
63.17 
63.17 Error occurred prerendering page "/settings/workspaces/editspaces". Read more: https://nextjs.org/docs/messages/prerender-error
63.17 
63.17 TypeError: fetch failed
63.17     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.17     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.17     at async n (/app/build/server/app/settings/datasets/[id]/page.js:1:18976)
63.17     at async p (/app/build/server/app/settings/workspaces/editspaces/page.js:1:12135)
63.37 Get request failed TypeError: fetch failed
63.37     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.37     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.37     at async n (/app/build/server/app/settings/workspaces/[id]/page.js:1:21597)
63.37     at async c (/app/build/server/app/settings/workspaces/page.js:1:10244) {
63.37   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
63.37       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
63.37       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
63.37     errno: -111,
63.37     code: 'ECONNREFUSED',
63.37     syscall: 'connect',
63.37     address: '127.0.0.1',
63.37     port: 8000
63.37   }
63.37 }
63.37 TypeError: fetch failed
63.37     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.37     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.37     at async n (/app/build/server/app/settings/workspaces/[id]/page.js:1:21597)
63.37     at async c (/app/build/server/app/settings/workspaces/page.js:1:10244) {
63.37   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
63.37       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
63.37       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
63.37     errno: -111,
63.37     code: 'ECONNREFUSED',
63.37     syscall: 'connect',
63.37     address: '127.0.0.1',
63.37     port: 8000
63.37   },
63.37   digest: '3812785553'
63.37 }
63.37 Get request failed TypeError: fetch failed
63.37     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.37     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.37     at async n (/app/build/server/app/settings/workspaces/[id]/page.js:1:21597)
63.37     at async c (/app/build/server/app/settings/workspaces/page.js:1:10244) {
63.37   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
63.37       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
63.37       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
63.37     errno: -111,
63.37     code: 'ECONNREFUSED',
63.37     syscall: 'connect',
63.37     address: '127.0.0.1',
63.37     port: 8000
63.37   }
63.37 }
63.37 TypeError: fetch failed
63.37     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.37     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.37     at async n (/app/build/server/app/settings/workspaces/[id]/page.js:1:21597)
63.37     at async c (/app/build/server/app/settings/workspaces/page.js:1:10244) {
63.37   cause: Error: connect ECONNREFUSED 127.0.0.1:8000
63.37       at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
63.37       at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
63.37     errno: -111,
63.37     code: 'ECONNREFUSED',
63.37     syscall: 'connect',
63.37     address: '127.0.0.1',
63.37     port: 8000
63.37   },
63.37   digest: '3812785553'
63.37 }
63.37 
63.37 Error occurred prerendering page "/settings/workspaces". Read more: https://nextjs.org/docs/messages/prerender-error
63.37 
63.37 TypeError: fetch failed
63.37     at Object.fetch (node:internal/deps/undici/undici:14152:11)
63.37     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
63.37     at async n (/app/build/server/app/settings/workspaces/[id]/page.js:1:21597)
63.37     at async c (/app/build/server/app/settings/workspaces/page.js:1:10244)
63.37  ✓ Generating static pages (15/15)
63.37 
63.37 > Export encountered errors on following paths:
63.37 	/(ee)/settings/logs/page: /settings/logs
63.37 	/settings/datasets/page: /settings/datasets
63.37 	/settings/workspaces/addspaces/page: /settings/workspaces/addspaces
63.37 	/settings/workspaces/editspaces/page: /settings/workspaces/editspaces
63.37 	/settings/workspaces/page: /settings/workspaces
------
failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1

🐛 Describe the bug

version: master
docker-compose.yml content as follows:

services:
  postgresql:
    image: postgres:16
    environment:
      POSTGRES_USER: pandasai
      POSTGRES_PASSWORD: password123
      POSTGRES_DB: pandasai-db
    ports:
      - "5430:5432"
    volumes:
      - ./pgdata:/var/lib/postgresql/data
    networks:
      - pandabi-network

  server:
    container_name: pandabi-backend
    build:
      context: ./server
      dockerfile: Dockerfile
    ports:
      - "8000:8000"
    restart: always
    env_file:
      - ./server/.env
    depends_on:
      - postgresql
    networks:
      - pandabi-network
    command: "/bin/bash startup.sh"

  client:
    container_name: pandabi-frontend
    depends_on:
      - server
    build:
      context: ./client
      dockerfile: Dockerfile
    ports:
      - "3000:3000"
    restart: always
    env_file:
      - ./client/.env
    environment:
      - NODE_ENV=development
    command: npm run start
    networks:
      - pandabi-network

networks:
  pandabi-network:
    driver: bridge
@dosubot dosubot bot added the bug Something isn't working label Jul 22, 2024
Copy link

dosubot bot commented Jul 22, 2024

Hey @linlin-coder! I'm here to help you with any bugs or questions you have while waiting for the human maintainers. Let's squash those bugs together! 🐞

The build process fails with a connect ECONNREFUSED 127.0.0.1:8000 error because the client service is trying to connect to the server service on port 8000, but the server service is not running at the time of the build.

To resolve this issue, ensure that the server service is properly configured and running before the client service attempts to connect to it. Here are some steps to help you fix this:

  1. Ensure server service is running: Make sure the server service is up and running before the client service tries to connect. You can use the wait-for-it.sh script to wait for the server service to be available.

  2. Modify client Dockerfile: Update the client Dockerfile to include a wait script that ensures the server service is available before running the build.

Here is an example of how you might modify the client Dockerfile:

# client/Dockerfile
FROM node:14

WORKDIR /app

COPY package*.json ./
RUN npm install

COPY . .

# Add wait-for-it.sh script
COPY wait-for-it.sh /wait-for-it.sh
RUN chmod +x /wait-for-it.sh

# Wait for the server to be available before running the build
CMD /wait-for-it.sh server:8000 -- npm run build
  1. Ensure wait-for-it.sh script is available: Make sure the wait-for-it.sh script is available in the client directory. Here is the content of the wait-for-it.sh script:
#!/bin/bash

host="$1"
shift
cmd="$@"

until nc -z "$host" 8000; do
  >&2 echo "Server is unavailable - sleeping"
  sleep 1
done

>&2 echo "Server is up - executing command"
exec $cmd
  1. Update docker-compose.yml: Ensure the client service depends on the server service and waits for it to be ready.
services:
  postgresql:
    image: postgres:16
    environment:
      POSTGRES_USER: pandasai
      POSTGRES_PASSWORD: password123
      POSTGRES_DB: pandasai-db
    ports:
      - "5430:5432"
    volumes:
      - ./pgdata:/var/lib/postgresql/data
    networks:
      - pandabi-network

  server:
    container_name: pandabi-backend
    build:
      context: ./server
      dockerfile: Dockerfile
    ports:
      - "8000:8000"
    restart: always
    env_file:
      - ./server/.env
    depends_on:
      - postgresql
    networks:
      - pandabi-network
    command: "/bin/bash startup.sh"

  client:
    container_name: pandabi-frontend
    depends_on:
      - server
    build:
      context: ./client
      dockerfile: Dockerfile
    ports:
      - "3000:3000"
    restart: always
    env_file:
      - ./client/.env
    environment:
      - NODE_ENV=development
    command: npm run start
    networks:
      - pandabi-network

networks:
  pandabi-network:
    driver: bridge

By ensuring the server service is running and available before the client service attempts to connect, you should be able to resolve the ECONNREFUSED error during the build process [1][2].

To continue talking to Dosu, mention @dosu.

@kisseternity
Copy link

Same error, any solution yet?

@userzhangqg
Copy link

到对应目录下面找到page.tsx文件里面添加这行:
export const dynamic = 'force-dynamic'

这个项目太多坑...

@kisseternity
Copy link

export const dynamic = 'force-dynamic'

Guess it's something related to js...
Finally it worked, thanks.

@linlin-coder
Copy link
Author

到对应目录下面找到page.tsx文件里面添加这行: export const dynamic = 'force-dynamic'

这个项目太多坑...

十分感谢,项目已启动起来

@linlin-coder
Copy link
Author

Same error, any solution yet?

You can refer to the above reply for settings, but the following files need to be modified

find -name "*page.tsx*"
./client/components/ChatLoader/page.tsx
./client/app/(ee)/settings/logs/page.tsx
./client/app/(ee)/settings/logs/[id]/page.tsx
./client/app/page.tsx
./client/app/admin/conversations/[id]/messages/page.tsx
./client/app/admin/page.tsx
./client/app/admin/chat/page.tsx
./client/app/settings/workspaces/page.tsx
./client/app/settings/workspaces/editspaces/page.tsx
./client/app/settings/workspaces/addspaces/page.tsx
./client/app/settings/workspaces/[id]/page.tsx
./client/app/settings/page.tsx
./client/app/settings/datasets/page.tsx
./client/app/settings/datasets/[id]/page.tsx
./client/app/settings/datasets/add/page.tsx
./client/app/settings/general/page.tsx

@jithin77
Copy link

到对应目录下面找到page.tsx文件里面添加这行: export const dynamic = 'force-dynamic'

这个项目太多坑...

export const dynamic = 'force-dynamic'

Guess it's something related to js... Finally it worked, thanks.

Hey, Did you get it working? I am having the same issue. Added "
export const dynamic = 'force-dynamic'" but did not help. See the content of my page.tsx below

"use client";
import { useRouter } from "next/navigation";
import React, { useEffect } from "react";
import { ROUTE_ADMIN } from "utils/constants";
import { useGetMe } from "@/hooks/useUsers";
import { Loader } from "@/components/loader/Loader";

export const dynamic = 'force-dynamic'

const MainPage = () => {
const router = useRouter();
const { data: workspaceResponse, isLoading, isError } = useGetMe();
const myDetails = workspaceResponse?.data;

const handleSpaceClick = () => {
localStorage.setItem("firstName", myDetails?.first_name);
localStorage.setItem("email", myDetails?.email);
localStorage.setItem("user_id", myDetails?.id);
localStorage.setItem(
"selectedOrganization",
JSON.stringify(myDetails?.organizations[0])
);
localStorage.setItem("spaceId", myDetails?.space?.id);
localStorage.setItem("spaceName", myDetails?.space?.name);
router.push(ROUTE_ADMIN);
};

useEffect(() => {
if (workspaceResponse?.data) {
handleSpaceClick();
}
}, [workspaceResponse]);

return (
<>
{isLoading && (




)}
{isError && (

Something went wrong fetching credentials, please refresh the page

)}
</>
);
};

export default MainPage;

@TupleTechnologies
Copy link

Any update on this issue? Looks like docker setup is not working as expected.

@TupleTechnologies
Copy link

Has anyone faced this issue on their Docker setup? Looks like it's not addressed yet.

@fidi-bus
Copy link

can confirm issue, running docker on manjaro linux, spin up server container beforehand does not solve it

@TupleTechnologies
Copy link

Any workaround here? Not able to get started because of this issue.

@khoonie
Copy link

khoonie commented Jul 30, 2024

I added the following line to the bottom of all the 15 page.tsx files found using find -name "page.tsx" :

export const dynamic = 'force-dynamic';

Ran docker-compose build again and went through successfully.

@gventuri
Copy link
Collaborator

@khoonie thanks a lot, could you submit a PR for that if it fixes the issue?

@khoonie khoonie linked a pull request Jul 31, 2024 that will close this issue
2 tasks
@lethehoa
Copy link

export const dynamic = 'force-dynamic';

It's worked, thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants