Tutorial - Error: P1001: "Can't reach database server at `postgres.railway.internal:5432`" when attempting to recreate prisma migration to Railway postgre

Hello!
I’m following the RedwoodJS Tutorial and I got stuck at:

I’m trying to change the Database from the local SQLite to Railway.
When I run “yarn rw prisma migrate dev” at the terminal to recreate the migration, I get:

“Error: P1001: Can’t reach database server at postgres.railway.internal:5432
Please make sure your database server is running at postgres.railway.internal:5432.”

The steps I’ve taken so far in this chapter:

  • Railway has been installed and its database server seems to be running; The psql shell, after having entered all the parameters and password, gives me a “postgres=#” prompt. Container seems to be up and running.
  • “Started a New Project”, with “Provision PostgreSQL”.
  • Updated the datasource db provider (= ‘postgresql’) at the schema.prisma file.
  • Entered the value I copied from the DATABASE_URL variable (The Variables section) in the .env file:

DATABASE_URL=postgresql://postgres:wxiApHDCsVLQaPghUiiEpxLzPtQwmVrF@postgres.railway.internal:5432/railway (and uncommented)

  • Deleted the api/db/migrations folder

Then, when I run “yarn rw prisma migrate dev” at the terminal to recreate the migration, I get:

“Error: P1001: Can’t reach database server at postgres.railway.internal:5432
Please make sure your database server is running at postgres.railway.internal:5432.”

I’ve tried wrapping the URI with single/double quotes ‘’/“”, and disabling the VPN with the same result.
The address stored at the Railway Postgre environment variable DATABASE_PUBLIC_URL CAN be reached, but if I use that instead, later on the Netlify deploy stops with error at the building section. The DATABASE_URL is the one required, according to the instructions, but that one cannot be reached during the migrate recreation.

I’m a noob on development, so I’m not really sure how to troubleshoot this, or what feedback info might pertain the most, but I’m very excited to look further into this if anyone is willing to give me a few pointers.
You can find my repo at:

VSCode 1.93.1 @win11 , Node.js 20.11.1, yarn 1.22.22.

Please, let me know if I could provide any logs or additional information that could be of more assistance.

Update:
It seems the whole Deployment section has been changed. Previously suggesting Netlify as the Deployment tool, now Grove is the favored one:

So, I’m trying to install the the Grove CLI, using the Git Bash tool (I’m using a Windows 11-based system) but it cannot resolve the host, giving me an error message:
“curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.”
At this point, I can’t continue with the tutorial, until I get access to Grove.
Grove is still in Alpha, does that mean I need an invitation to use it from you, guys?
PS: Sorry if this is posted as a reply (instead of as an update) to my original post, but I didn’t find any other option.

Hey @RedWoodHiker :wave:

I’m not sure why you’d be getting that issue with grove. You don’t need any sort of invite from us to use grove but it’s not got amazing documentation yet.

You can stick with the railway based approach by using v8.2 of the docs which you select from the little version dropdown on the top level of the docs site.

One thing to try with the railway database is to the use DATABASE_PUBLIC_URL which might work ifthe DATABASE_URL doesn’t.

Is the spot Josh mentioned.

2 Likes

Thank you, Josh!
Update:
I sticked to the instructions on v8.2, for simplicity sake.



DATABASE_URL can’t be reached when re-creating the prisma migration. DATABASE_PUBLIC_URL, as you suggested, could be reached. So, I:
-Disconnected my VPN, just in case.

  • Updated the DATABASE_URL variable with the public URL address, and saved the .env file.
  • Deleted the already existing api/db/migrations folder completely again.
  • Deleted the netlify.toml file (from the previous deploy attempt)
  • Ran the “yarn rw prisma migrate dev” command, to re-create a new migration. It propmted me to reset the existing schema (->Yes). And it finished successfully.
  • Commited the changes to my Github repo, fro where Netlify is going to pull the data.
  • Confirmed the Netlify container on my account is still up and running.
  • Tried to launch the deploy again (with cache deletion)
  • The Netlify deploy failed at the build stage, stating the database server (at the address stored at the DATABASE_PUBLIC_URL variable) can’t be reached.

I tried this whole process many times, just to make sure I was following it correctly, with the same results.
If I try using the private value, it still can’t be reached during the migration process.
Web searching the error only hinted about delaying the access, in some cases, and enabling an option on for Alpine users; none of which seem to apply to my scenario.
I’ll post this simultaneously on your Discord channel, too, to widen my assistance chances.
I’ll attach logs and screenshots.
Any ideas?