Prisma can't connect with an IPv6 host

I’m making this post more for general awareness for those who aren’t aware of the issue: Prisma can't connect with an IPv6 host · Issue #18079 · prisma/prisma · GitHub

I’m facing this exact issue at the moment. I can connect to the database just fine with psql when SSHing into my app instance, but prisma does not seem to like an IPv6 address in DATABASE_URL.

I’m not much of a networking wizard but does anybody here have a patch-over solution to this? My first thought is to edit the /etc/hosts file, mapping the IPv6 address to a hostname, and then use the hostname in my DATABASE_URL. I think I’ll give this a try and edit this post later if it works.

2 Likes

We have some workarounds for this in the works, hopefully we can get those out the door in the next few days. For now using the appname.internal address is the best workaround we have.

1 Like

nice, that did the trick for me.

Steps for people to follow along:

  1. fly ssh console
  2. In the SSH prompt, echo "$DATABASE_URL"
  3. Copy that then exit out of the SSH prompt.
  4. fly secrets set DATABASE_URL="DB_URL_HERE", where DB_URL_HERE will be what you copied but with the IPv6 address replaced with YOUR_POSTGRES_APP_NAME.internal.
2 Likes

Thanks for the details @interopera !

How can we get the $DATABASE_URL if there’s no existing instance of the server running (i.e. we can’t fly ssh console into the app)?

Also for the 4th step, do I understand it right that Fly will handle the “replacing”? Can we also use the internal.postgres_app_name address all along or are there some limits?

Thanks!

If you haven’t deployed your app yet then you can do so with fly launch I believe. Starter guides are here: Language & Framework Guides · Fly Docs

Otherwise, if you can’t do fly ssh console because your app instance is failing, there’s not much I can really suggest other than checking logs + related posts.

Also for the 4th step, do I understand it right that Fly will handle the “replacing”? Can we also use the internal.postgres_app_name address all along or are there some limits?

Fly won’t handle the replacing, you’ll need to manually copy the DATABASE_URL and manually replace the IPv6 address with YOUR_POSTGRES_APP_NAME.internal

We have a solve for this: New Feature: .flycast domains

2 Likes