23 days ago
Service: Finance Module Sattikulambu (ID: 6bacabb9-907d-4eaa-8f6f-506f7d71c3c9)
TCP proxy on port 5432 configured but no port is being assigned
DATABASE_PUBLIC_URL showing <YOUR_ASSIGNED_PORT> placeholder instead of actual port
Cannot connect externally
Database is running but unreachable
21 Replies
23 days ago
This thread has been opened as a bounty so the community can help solve it.
Status changed to Open Railway • 23 days ago
23 days ago
You have to enable the TCP proxy for your PostgreSQL service in the Railway dashboard.
onsepro-official

23 days ago
Your service only requires a redeployment to pull the newly provisioned TCP network variables into the container's environment.
onsepro-official
 Public Url not created automatically
23 days ago
-
In that exact Variables tab you screenshotted, click the + New Variable button.
-
Set the Variable Name to: DATABASE_PUBLIC_URL
-
Set the Value to your custom connection string, utilizing Railway's built-in reference variables alongside your public proxy domain and port:
postgresql://${PGUSER}:${PGPASSWORD}@sakura.proxy.rlwy.net:30270/${PGDATABASE} -
Click Add.
23 days ago
msns-dev
1. In that exact Variables tab you screenshotted, click the + New Variable button. 2. Set the Variable Name to: DATABASE_PUBLIC_URL 3. Set the Value to your custom connection string, utilizing Railway's built-in reference variables alongside your public proxy domain and port: postgresql://${PGUSER}:${PGPASSWORD}@sakura.proxy.rlwy.net:30270/${PGDATABASE} 4. Click Add.
23 days ago
Does not work still error
onsepro-official
Tried deleting the current TCP proxy and then created it again Still 
23 days ago
You must URL-encode your password inside the connection string
onsepro-official
Does not work still error
23 days ago
Final steps to follow now:
-
Go to the Networking tab and copy your new TCP proxy port.
-
Go to the Variables tab and copy your PGPASSWORD.
-
If your password has special characters, use a free online URL-encoder.
-
Update your Prisma .env file with the strict format:
DATABASE_URL="postgresql://postgres:<URL_ENCODED_PASSWORD>@sakura.proxy.rlwy.net:<NEW_PORT>/<YOUR_DB_NAME>
msns-dev
Final steps to follow now: 1. Go to the Networking tab and copy your new TCP proxy port. 2. Go to the Variables tab and copy your PGPASSWORD. 3. If your password has special characters, use a free online URL-encoder. 4. Update your Prisma .env file with the strict format: DATABASE_URL="postgresql://postgres:<URL_ENCODED_PASSWORD>@sakura.proxy.rlwy.net:<NEW_PORT>/<YOUR_DB_NAME>
23 days ago
Connection Failed!
Invalid prisma.$queryRaw() invocation: Authentication failed against database server at sakura.proxy.rlwy.net, the provided database credentials for postgres are not valid. Please make sure to provide valid database credentials for the database server at sakura.proxy.rlwy.net.
got this error for that
23 days ago
any other to take data backup and restore to another Postgres service ?
onsepro-official
any other to take data backup and restore to another Postgres service ?
23 days ago
If you want to abandon the current instance and migrate to a fresh Postgres service, you can easily pull your data and restore it using standard PostgreSQL CLI tools (pg_dump and pg_restore).
You want guide on this?
Note: The Prisma authentication error you were experiencing is almost certainly due to special characters in your automatically generated PGPASSWORD
23 days ago
tell me how to migrate to a fresh Postgres service
23 days ago
Step 1: export the Backup
Open your local machine's terminal and run pg_dump using your current proxy details.
pg_dump -h sakura.proxy.rlwy.net -p 30270 -U postgres -d postgres -F c -f railway_backup.dumpPaste your current PGPASSWORD from your service variables tab
Step 2: Create the New Service
2.1. Go to Railway project canvas, click + New -> Database -> PostgreSQL to spin up the fresh service.
2.2. Go to the Networking tab of this new service and enable Public Networking to generate its new TCP Proxy domain and port.
2.3. Go to its Variables tab and note the new PGPASSWORD.
Step 3: Restore/import the Data
Use pg_restore to push your railway_backup.dump file to the new service, using newly generated proxy domain and port
pg_restore -h <NEW_PROXY_DOMAIN> -p <NEW_PROXY_PORT> -U postgres -d postgres -1 railway_backup.dumponsepro-official
tell me how to migrate to a fresh Postgres service
23 days ago
Follow the mentioned steps to migrate to a fresh new service
23 days ago
in CMD ?
onsepro-official
in CMD ?
23 days ago
Yes (bash specifically)
23 days ago
C:\Users\User> pg_dump -h sakura.proxy.rlwy.net -p 30270 -U postgres -d postgres -F c -f railway_backup.dump
'pg_dump' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\User>
onsepro-official
C:\Users\User> pg_dump -h sakura.proxy.rlwy.net -p 30270 -U postgres -d postgres -F c -f railway_backup.dump 'pg_dump' is not recognized as an internal or external command, operable program or batch file. C:\Users\User>
23 days ago
Use bash terminal or use powershell
onsepro-official
C:\Users\User> pg_dump -h sakura.proxy.rlwy.net -p 30270 -U postgres -d postgres -F c -f railway_backup.dump 'pg_dump' is not recognized as an internal or external command, operable program or batch file. C:\Users\User>
23 days ago
you must have the PostgreSQL command-line tools installed on your machine and added to your system's Environment Variables (PATH).
onsepro-official
C:\Users\User> pg_dump -h sakura.proxy.rlwy.net -p 30270 -U postgres -d postgres -F c -f railway_backup.dump 'pg_dump' is not recognized as an internal or external command, operable program or batch file. C:\Users\User>
19 days ago
I'd recommend running the pg_dump command inside the Console tab of your database, then download the dump from the filebrowser below.
After recreating the new service, go to the Console tab of the new Postgres service, upload the dump file in the filebrowser, then run pg_restore from the built in console.