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

da1zHOBBY

a year ago

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?

0 Replies

da1zHOBBY

a year ago

N/A


da1zHOBBY

a year ago

more of a questing is how to get pooled connections string?


a year ago

I would just use the standard pg node library


da1zHOBBY

a year 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


a year ago

You should be able to use the DATABASE_URL environment variable.


da1zHOBBY

a year ago

i tried to but i am getting error: VercelPostgresError - 'invalidconnectionstring': This connection string is meant to be used with a direct connection. Make sure to use a pooled connection string or try createClient() instead.


da1zHOBBY

a year ago

i can use createClient() but does it mean I am loosing pooled connection?


a year ago

I think that would be a question for vercel's documentation?


da1zHOBBY

a year ago

yes it is non pooling connection


da1zHOBBY

a year ago

i checked


a year ago

if I'm not mistaken pg has a pooled client


da1zHOBBY

a year ago

hm they seem to be just checking url to determine connection string type:
export function isPooledConnectionString(connectionString: string): boolean { return connectionString.includes('-pooler.'); }


da1zHOBBY

a year ago

so i guess i can not use pooled client


a year ago


da1zHOBBY

a year ago

yeah. thank you. i guess i'll go with pg. not a big deal just wanted to use vercel's package


da1zHOBBY

a year ago

ah seems like pg is not edge compatbile, so there is a benefit of vercel/postgres


a year ago

railway does not run any user workloads on the edge