6

So I'm currently following this tutorial from DigitalOcean: https://www.digitalocean.com/community/tutorials/how-to-build-a-graphql-api-with-prisma-and-deploy-to-digitalocean-s-app-platform I created a postgres database hosted on digitalocean. When I try to connect to it with the following command:

DATABASE_URL="postgresql://db:some_password@unique_identifier.db.ondigitalocean.com:25060/db?sslmode=require" npx prisma migrate deploy --preview-feature

and replace the DATABASE_URL with my personal Connection String it gives me the following error:

"Error: P1001: Can't reach database server at app-0336e984censored29-do-user-10651-0.b.db.ondigitalocean.com:25060"

Please make sure your database server is running at app-0336e984censored29-do-user-10651-0.b.db.ondigitalocean.com:`25060

What is going wrong? My Database is live and the link is also correct

HavanaSun
  • 446
  • 3
  • 12
  • 39
  • In my case, I forgot to run `sudo ufw allow 3306/tcp`. The only reason the connection was working from my home office was because I'd already allow-listed that IP address. – Ryan Feb 20 '23 at 02:22

1 Answers1

0

i think that the problem is that until the app is built, there is no static IP and therefore no access to the database, see this article: https://www.digitalocean.com/community/questions/why-managed-database-can-t-have-app-platform-as-trusted-source

i solve it by moving the migration command to the 'run' section, see image

1

vimuth
  • 5,064
  • 33
  • 79
  • 116
shlomo
  • 1
  • 2