docker icon indicating copy to clipboard operation
docker copied to clipboard

Error: Could not find a production build in the '/app/.next' directory.

Open ffrpr opened this issue 4 years ago • 9 comments

When I try to docker-compose up -d --build, the build is completed successfully but the calendso app container keeps restarting. Looking into docker logs, I get these errors:

+ /app/scripts/wait-for-it.sh db:5432 -- echo 'db is up'
db is up
+ npx prisma db push
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "calendso", schema "public" at "db:5432"

The database is already in sync with the Prisma schema.

✔ Generated Prisma Client (2.30.3) to ./node_modules/@prisma/client in 746ms

+ yarn start
yarn run v1.22.5
$ next start
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info  - Loaded env from /app/.env
Error: Could not find a production build in the '/app/.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
    at Server.readBuildId (/app/node_modules/next/dist/server/next-server.js:1573:23)
    at new Server (/app/node_modules/next/dist/server/next-server.js:92:29)
    at NextServer.createServer (/app/node_modules/next/dist/server/next.js:107:16)
    at async /app/node_modules/next/dist/server/next.js:119:31
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
+ /app/scripts/wait-for-it.sh db:5432 -- echo 'db is up'
db is up
+ npx prisma db push
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "calendso", schema "public" at "db:5432"

The database is already in sync with the Prisma schema.

✔ Generated Prisma Client (2.30.3) to ./node_modules/@prisma/client in 684ms

┌─────────────────────────────────────────────────────────┐
│  Update available 2.30.3 -> 3.2.1                       │
│                                                         │
│  This is a major update - please follow the guide at    │
│  https://pris.ly/d/major-version-upgrade                │
│                                                         │
│  Run the following to update                            │
│    npm i --save-dev prisma@latest                       │
│    npm i @prisma/client@latest                          │
└─────────────────────────────────────────────────────────┘
+ yarn start
yarn run v1.22.5
$ next start
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info  - Loaded env from /app/.env
Error: Could not find a production build in the '/app/.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
    at Server.readBuildId (/app/node_modules/next/dist/server/next-server.js:1573:23)
    at new Server (/app/node_modules/next/dist/server/next-server.js:92:29)
    at NextServer.createServer (/app/node_modules/next/dist/server/next.js:107:16)
    at async /app/node_modules/next/dist/server/next.js:119:31
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
+ /app/scripts/wait-for-it.sh db:5432 -- echo 'db is up'
db is up
+ npx prisma db push
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "calendso", schema "public" at "db:5432"

The database is already in sync with the Prisma schema.

✔ Generated Prisma Client (2.30.3) to ./node_modules/@prisma/client in 459ms

+ yarn start
yarn run v1.22.5
$ next start
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info  - Loaded env from /app/.env

ffrpr avatar Oct 08 '21 16:10 ffrpr

Also addressing this in my WIP dockerfile updates

krumware avatar Oct 08 '21 20:10 krumware

please re-test with the current build

krumware avatar Nov 24 '21 17:11 krumware

Closing for inactivity

krumware avatar Jan 06 '22 15:01 krumware

I am experiencing this issue with the most up to date version of this repo

phyroslam avatar Jul 25 '22 20:07 phyroslam

Are you experiencing the issue with your own built image or the provided image?

krumware avatar Jul 25 '22 20:07 krumware

with my own built image

phyroslam avatar Jul 25 '22 21:07 phyroslam

Experiencing the same issue with the current version of the repo after trying to build the image with the instructions provided in the README

adriansteffan avatar Sep 10 '22 12:09 adriansteffan

Using typescript, nothing changed. Unable to find the production build when running DEV

ntalamdotcom avatar Dec 07 '22 09:12 ntalamdotcom

And now this is happening to me too. This takes place after I ran into issues with an outdated yarn lockfile in the latest codebase.

I'm astounded by how frequently I run into new issues every time I update and attempt to redeploy our docker instance. One of the points of containerization is to remove environment-based issues. Why does the docker container rely on build-time variables? Is there a roadmap for converting these variables to runtime-only?

carsonbird avatar Nov 22 '23 01:11 carsonbird