WaspW
Wasp13mo ago
William Jin

Manipulating production database with fly.io and wasp db studio

@kapa.ai
I used the Wasp CLI to deployed my db (skyblaze-db). I followed the tutorial by:

Run fly proxy 5432 -a skyblaze-db and got Proxying local port 5432 to remote [skyblaze-db.internal]:5432

Put
DATABASE_URL
in my .env.server: DATABASE_URL=postgres://postgres:<password>@localhost:5432/skyblaze-db

However I got
❌ --- [Error] Can not connect to database: ---------------------------------------

The database needs to be running in order to execute this command. You can easily start a managed dev database with `wasp start db`.

When I run wasp db studio.

My question is:

  1. is the database password something I got when first deployed to fly.io, with 15 characters? I got the message ```Postgres cluster skyblaze-db is now attached to skyblaze-serverThe following secret was added to skyblaze-server:DATABASE_URL=postgres://skyblaze_server:<credential>@skyblaze-db.flycast:5432/skyblaze_server?sslmode=disablePlease take note of your database credentials above, as they will not be available in plaintext again. Press any key to continue.```
  2. If so, which sould be correct? `DATABASE_URL=postgres://postgres:<credential>@localhost:5432/skyblaze-db`or`DATABASE_URL=postgres://skyblaze_server:<credential>@skyblaze-db.flycast:5432/skyblaze_server?sslmode=disable`
  3. How should I fix the ```❌ --- [Error] Can not connect to database: ---------------------------------------
The database needs to be running in order to execute this command. You can easily start a managed dev database with wasp start db.```?

Thanks!
Was this page helpful?