Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

2.4K
Views
M1 Related! - Prisma: Can't reach database server at `database`:`5432`

Since I have moved to the new Apple Silicon architecture my docker setup with nextjs and postgres is not working anymore. The database inside the docker cannot be found by the nextjs server where I am using prisma.

The prisma client can't reach the postgres database on port 5432.

Can't reach database server at test-postgres:5432

The migration also does not work and returns the same error above.

docker-compose run --publish 5555:5555 next npx prisma migrate dev

docker-compose.yml

postgres:
    container_name: 'test-postgres'
    restart: unless-stopped
    image: 'postgres:13'
    ports:
      - '15432:5432'
    volumes:
      - 'pgdata:/var/lib/postgresql/data/'
    environment:
      POSTGRES_PASSWORD: postgres

.env

DATABASE_URL="postgres://postgres:postgres@localhost:15432/postgres"

I have also added the arm binary target to the schema.prisma schema.prisma


generator client {
  provider        = "prisma-client-js"
  binaryTargets   = ["native", "debian-openssl-1.1.x", "linux-arm-openssl-1.1.x", "linux-musl"]
  previewFeatures = ["orderByRelation", "selectRelationCount"]
}

The postgres container is actually running and I can see it through the Docker Desktop Dashboard. One thing I have noticed inside the postgres container was this ERROR:

2021-07-21 12:52:58.927 UTC [76] ERROR:  relation "_prisma_migrations" does not exist at character 126

Have someone experienced it before and found a solution for it?

[EDIT]

How to reproduce

clone repo, follow README.md and see expected behaviour on a M1 Apple Silicon Machine: https://github.com/baristikir/prisma-postgres-M1

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Adding ?connect_timeout=300 to the connection string of the database did the trick.

DATABASE_URL="postgres://postgres:postgres@localhost:15432/postgres?connect_timeout=300"
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!