can i use railway postgres db with @vercel/postgres ?

I am try trying to use railway postgress db with @vercel/postgres. Is it compatible? How do I map railway variables to required vercel env varaibles?
13 Replies
Percy
Percy7mo ago
Project ID: N/A
kiryl_ch
kiryl_chOP7mo ago
N/A more of a questing is how to get pooled connections string?
Brody
Brody7mo ago
I would just use the standard pg node library
kiryl_ch
kiryl_chOP7mo ago
hm i like vercel api and it says that it is fully compatible with pg node. so i assume i can use it with railway postgress just need to figure out connection string
root
root7mo ago
You should be able to use the DATABASE_URL environment variable.
kiryl_ch
kiryl_chOP7mo ago
i tried to but i am getting error: VercelPostgresError - 'invalid_connection_string': This connection string is meant to be used with a direct connection. Make sure to use a pooled connection string or try createClient() instead. i can use createClient() but does it mean I am loosing pooled connection?
Brody
Brody7mo ago
I think that would be a question for vercel's documentation?
kiryl_ch
kiryl_chOP7mo ago
yes it is non pooling connection i checked
Brody
Brody7mo ago
if I'm not mistaken pg has a pooled client
kiryl_ch
kiryl_chOP7mo ago
hm they seem to be just checking url to determine connection string type: export function isPooledConnectionString(connectionString: string): boolean { return connectionString.includes('-pooler.'); } so i guess i can not use pooled client
kiryl_ch
kiryl_chOP7mo ago
yeah. thank you. i guess i'll go with pg. not a big deal just wanted to use vercel's package ah seems like pg is not edge compatbile, so there is a benefit of vercel/postgres
Brody
Brody7mo ago
railway does not run any user workloads on the edge
Want results from more Discord servers?
Add your server