App can't connect to db after recreating

Hey all, I ran into a nasty Prisma migration that failed in prod. I had no real data in prod yet so I decided to just recreate the database. I then ran into issues re-attaching to the app so I ended up destroying the app too and just starting all over. The app is a Remix app, using Prisma, and a Postgres database.

Now if I do the following:

  • create postgres
  • proxy to postgres
  • run prisma migrate
  • create app
  • attach postgres to app

Everything succeeds up to this point. If I then try either a fly launch or push a commit to my repo to trigger a deploy the deploy fails saying that the app can’t connect to the db during the prisma migration step.

--> This release will not be available until the release command succeeds.
         Starting instance
         Configuring virtual machine
         Pulling container image
         Unpacking image
         Preparing kernel init
         Starting virtual machine
         Starting init (commit: 08b4c2b)...
         Preparing to run: `docker-entrypoint.sh pnpx prisma migrate deploy` as root
         2023/02/25 17:26:11 listening on [fdaa:0:8aa8:a7b:a6:242b:9d2:2]:22 (DNS: [fdaa::3]:53)
         .../share/pnpm/store/v3/tmp/dlx-522      | Progress: resolved 1, reused 0, downloaded 0, added 0
         Starting instance
         Configuring virtual machine
         Pulling container image
         Unpacking image
         Preparing kernel init
         Configuring firecracker
         Starting virtual machine
         Starting init (commit: 08b4c2b)...
         Preparing to run: `docker-entrypoint.sh pnpx prisma migrate deploy` as root
         2023/02/25 17:26:11 listening on [fdaa:0:8aa8:a7b:a6:242b:9d2:2]:22 (DNS: [fdaa::3]:53)
         .../share/pnpm/store/v3/tmp/dlx-522      | Progress: resolved 1, reused 0, downloaded 0, added 0
         .../share/pnpm/store/v3/tmp/dlx-522      | Progress: resolved 2, reused 0, downloaded 1, added 1
         .../share/pnpm/store/v3/tmp/dlx-522      | Progress: resolved 2, reused 0, downloaded 1, added 1
         .../node_modules/@prisma/engines postinstall$ node scripts/postinstall.js
         .../share/pnpm/store/v3/tmp/dlx-522      | Progress: resolved 2, reused 0, downloaded 2, added 2, done
         .../node_modules/@prisma/engines postinstall$ node scripts/postinstall.js
         .../share/pnpm/store/v3/tmp/dlx-522      | Progress: resolved 2, reused 0, downloaded 2, added 2, done
         .../node_modules/@prisma/engines postinstall: Done
         .../node_modules/@prisma/engines postinstall: Done
         .../prisma@4.10.1/node_modules/prisma preinstall$ node scripts/preinstall-entry.js
         .../prisma@4.10.1/node_modules/prisma preinstall$ node scripts/preinstall-entry.js
         .../prisma@4.10.1/node_modules/prisma install$ node scripts/install-entry.js
         .../prisma@4.10.1/node_modules/prisma install$ node scripts/install-entry.js
         .../prisma@4.10.1/node_modules/prisma install: Done
         .../prisma@4.10.1/node_modules/prisma install: Done
         Prisma schema loaded from prisma/schema.prisma
         Error: P1001: Can't reach database server at `[fdaa:0:8aa8:0:1::4]`:`5432`
          ERROR  Command failed with exit code 1: prisma migrate deploy
         pnpm: Command failed with exit code 1: prisma migrate deploy**strong text**

I have verified the address is correct for the database.

I am having same issue, tried multiple things but it doesn’t work.

I ended up fixing this based on a tip from another thread. ipv6 seems to be busted so I had to switch to the internal domain name instead.

What was your fix?

Facing same issue at my end. Above fix didn’t brought any change.
Why change to “productotter-db-internal” ? Is it some standard usage ?

Use the hostname instead of the ip address.