Unnable to connect database service after migration

I made the migration from database legacy plugin to database service as requested using the one-click automated migration, after that my API service started crashing because it was unable to connect with my database service. I've tried to connect with the database service using the DATABASE_PRIVATE_URL and DATABSE_URL and none of this worked
Solution:
stick to using DATABASE_URL for now please try this solution https://discord.com/channels/713503345364697088/1194241277517115443/1194568475071483944...
Jump to solution
21 Replies
Percy
Percyβ€’10mo ago
Project ID: N/A
saavedragaming98
saavedragaming98β€’10mo ago
numerous-twist Project ID: 24a05dcd-a288-4ba9-8e93-246f8cb9f0fb
Brody
Brodyβ€’10mo ago
can you connect to the database locally with something like dbgate?
saavedragaming98
saavedragaming98β€’10mo ago
Yes
Brody
Brodyβ€’10mo ago
what environment variable do you use in your code to connect to the database?
saavedragaming98
saavedragaming98β€’10mo ago
I runned my API service locally using the public connection string and worked correctly DATABASE_URL
Brody
Brodyβ€’10mo ago
and you have that set as a service variable?
saavedragaming98
saavedragaming98β€’10mo ago
Yup
Brody
Brodyβ€’10mo ago
are you using the reference variable syntax? as shown here https://docs.railway.app/guides/variables#referencing-another-services-variable
saavedragaming98
saavedragaming98β€’10mo ago
No description
saavedragaming98
saavedragaming98β€’10mo ago
I've also tried setting the value with Postgres.DATABASE_PRIVATE_URL
Brody
Brodyβ€’10mo ago
looks good, what specific error are you getting in the logs?
saavedragaming98
saavedragaming98β€’10mo ago
No description
saavedragaming98
saavedragaming98β€’10mo ago
This happens when I use Postgres.DATABASE_URL
Brody
Brodyβ€’10mo ago
at what point in your applications lifecycle do you see this error
saavedragaming98
saavedragaming98β€’10mo ago
If I set the ENV variable to Postgres.DATABASE_PRIVATE_URL the error shows on deploy phase. with the value set to Postgres.DATABASE_URL happens when starting up the service
Solution
Brody
Brodyβ€’10mo ago
stick to using DATABASE_URL for now please try this solution https://discord.com/channels/713503345364697088/1194241277517115443/1194568475071483944
saavedragaming98
saavedragaming98β€’10mo ago
still having the same problem
Brody
Brodyβ€’10mo ago
show me how you have implemented their proposed fix please
saavedragaming98
saavedragaming98β€’10mo ago
nevermind, it was my bad πŸ˜… Thanks a lot Brody!
Brody
Brodyβ€’10mo ago
no problem!
Want results from more Discord servers?
Add your server