postgres.railway.internal:5432
9 months ago
project id: 301d93c7-c16d-4ff0-9f98-82ccecf37d09
I want to deploy my blitz js (nextjs) app with a postgres DB. The postgres seems to be fine, I also defined the six postgres related env. vars in my app deployment as described in the documentation and they also seem to work, because the database connection URL looks fine in the logs but still I get the error mentioned in the title.
During building the docker image one of the steps is to run a database migration and there I get the following error.
12 1.428 Error: P1001: Can't reach database server at postgres.railway.internal:5432
12 1.428
12 1.428 Please make sure your database server is running at postgres.railway.internal:5432
.
The full log of my deployment:
10 13.60 Done in 13.11s.
10 DONE 13.8s
11 [stage-0 7/10] COPY . /app/.
11 DONE 0.0s
12 [stage-0 8/10] RUN --mount=type=cache,id=s/e7dddd37-29e0-4ded-a2f0-783867505cdd-next/cache,target=/app/.next/cache --mount=type=cache,id=s/e7dddd37-29e0-4ded-a2f0-783867505cdd-nodemodules/cache,target=/app/nodemodules/.cache yarn run build
12 0.478 yarn run v1.22.22
12 0.505 $ yarn blitz prisma migrate deploy && yarn blitz prisma generate && yarn blitz build
12 0.696 $ /app/node_modules/.bin/blitz prisma migrate deploy
12 0.775 Loaded env from /app/.env
12 1.321 Environment variables loaded from .env
12 1.321 Prisma schema loaded from db/schema.prisma
12 1.324 Datasource "db": PostgreSQL database "railway", schema "public" at "postgres.railway.internal:5432"
12 1.427
12 1.428 Error: P1001: Can't reach database server at postgres.railway.internal:5432
12 1.428
12 1.428 Please make sure your database server is running at postgres.railway.internal:5432
.
12 1.448 error Command failed with exit code 1.
12 1.448 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
12 1.470 error Command failed with exit code 1.
12 1.471 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
12 ERROR: process "/bin/bash -ol pipefail -c yarn run build" did not complete successfully: exit code: 1
[stage-0 8/10] RUN --mount=type=cache,id=s/e7dddd37-29e0-4ded-a2f0-783867505cdd-next/cache,target=/app/.next/cache --mount=type=cache,id=s/e7dddd37-29e0-4ded-a2f0-783867505cdd-nodemodules/cache,target=/app/nodemodules/.cache yarn run build:
1.321 Prisma schema loaded from db/schema.prisma
1.324 Datasource "db": PostgreSQL database "railway", schema "public" at "postgres.railway.internal:5432"
1.427
1.428 Error: P1001: Can't reach database server at postgres.railway.internal:5432
1.428
1.428 Please make sure your database server is running at postgres.railway.internal:5432
.
1.448 error Command failed with exit code 1.
1.448 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
1.470 error Command failed with exit code 1.
1.471 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2 warnings found (use --debug to expand):
UndefinedVar: Usage of undefined variable '$NIXPACKS_PATH' (line 18)
LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 18)
Dockerfile:24
22 | # build phase
23 | COPY . /app/.
24 | >>> RUN --mount=type=cache,id=s/e7dddd37-29e0-4ded-a2f0-783867505cdd-next/cache,target=/app/.next/cache --mount=type=cache,id=s/e7dddd37-29e0-4ded-a2f0-783867505cdd-nodemodules/cache,target=/app/nodemodules/.cache yarn run build
25 |
26 |
ERROR: failed to solve: process "/bin/bash -ol pipefail -c yarn run build" did not complete successfully: exit code: 1
Error: Docker build failed
ⓘ Deployment information is only viewable by project members and Railway employees.
2 Replies
9 months ago
Thank you.
Unfortunately it did not help because before the migration after 10 minutes build time the build process was killed. I guess it was some kind of timeout.
But it gave me the idea to move the migration to the start script and that solved the problem.
Status changed to Solved brody • 9 months ago