Railway Vercel integration, failing to connect
Hey! So I'm using Railway to host my DB, project hosted on Vercel. I just set up a staging environment in Railway so that my preview deployments in Vercel don't mess with the data in my production database.
However, the builds fail to connect to Railway since installing the integration. Here is the error:
error: Error validating datasource
db: the URL must start with the protocol
postgresql:// or
postgres://
I suspect the integration is dynamically setting the DB url connection string, however it's not supplying it in the correct format? I'm not sure. There isn't a whole lot of options in the integration configuration. Can anyone point me to more details / documentation or help solve this issue? Thanks!
Btw, using Redwood JS as a framework, which uses Prisma under the hood. So technically that error is coming from Prisma. Other error details:
```
Error: Schema validation error - Error (query-engine-node-api library)
Error code: P1012
error: Error validating datasource
db: the URL must start with the protocol
postgresql:// or
postgres://`.
```7 Replies
Did you echo the DB URL in your function? Making sure it’s the right envvar?
I can't figure out an easy way to do this... hmm
because it fails during the build step. installs npm, sets up schema, then trys to connect and fails. Trying to figure out how I can echo out the env variable somewhere before it fails
Did Vercel add the concept of build variables recently?
I wonder if it’s that…
I'm not sure. I'm testing out a
prebuild
script in my package.json
I wish there was some documentation in how this works. Does Railway know to dynamically set the DATABASE_URL
environment variable? is that how it works?
assuming not, because that's just an env name I made up. But there wasn't any configuration for that
touching back on this, still unable to connect to staging DB on runway. Very difficult to log the issue. Some insight into how the environment integration works would be great! does it look for a special env
variable? does it pass along a connection URL string? or should I be prepared to format it?It should just pass along the variables
ahhhh. There seems to be a bug with Vercel's display of the env variables. I had to edit a variable, then cancel the edit before all of the railway vars showed up. I also already had a
DATABASE_URL
var setup, which broke the integration setup. I had to remove that variable, then reinstall the integration for everything to work. Then Railway was able to set the proper DATABASE_URL
varsNice
Ya we don't override variables but maybe we can send you an email being like "Yo, this collision happened"