DIRECT_URLresolved to an empty string
2 months ago
Hello! I have been migrating my monorepo project to using bun (v1.3.0) from pnpm, and to latest no-rust prisma (v6.17.1). For some reason I get this prisma error when running prisma generate on this instance
bun install v1.3.0 (b0a6feca)
Resolving dependencies
Resolved, downloaded and extracted [1]
$ bun --filter db generate
db generate: Prisma schema loaded from prisma/schema.prisma
db generate: Error: Prisma schema validation - (get-config wasm)
db generate: Error code: P1012
db generate: error: Error validating datasource db: You must provide a nonempty direct URL. The environment variable DIRECT_URL resolved to an empty string.
db generate: --> prisma/schema.prisma:12
db generate: |
db generate: 11 | url = env("DATABASE_URL")
db generate: 12 | directUrl = env("DIRECT_URL")
db generate: |
db generate:
db generate: Validation Error Count: 1
db generate: [Context: getConfig]
db generate:
db generate: Prisma CLI Version : 6.17.1
db generate: Exited with code 1
error: postinstall script from "suupa" exited with 1
The prisma generate is run as postinstall script. I have triple checked that there is DATABASE_URL environment variable specified. I tired using both Railway variables and plain strings, private and public deployments. But still get the error.
Also, I noticed that deployment is assigned Railpack 0.3.0 while latest version is 0.9.1
I have other services in my monorepo project that I migrated to bun and latest prisma, and they usage the same install script and share the same package with prisma, and they build and deploy without problems.
4 Replies
2 months ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
2 months ago
Also, after build fails with Build Failed: bc.Build: failed to solve: process "bun install --frozen-lockfile" did not complete successfully: exit code: 1 it tries to build it again and again in what seems a forever loop.
2 months ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open brody • about 2 months ago
a month ago
Tried to experiment with it. Added specific railpack version(0.9.1) to railway.json, it started using 0.9.2 railpack.
Also added railpack.json with a step to check if there there is indeed DIRECT_URL via echo ... , and it showed nothing! After some time, it fell back to railpack 0.3.0 and it wan't even able to pickup my railpack.json, even though I haven't moved it anywhere. Had to redeploy and change regions several times for it to start builds with 0.9.2 railpack that would properly find my railpack.json.
After a lot of back and forth with no success, I just created a new service, simply copies everything(config, envs) and IT JUST WORKED!
Not sure what it was, builder issue, or some frontend-backend problems, but hope the team will look into it.
a month ago
hey, im glad it worked out! i think what happened was inconsistent railpack builder version vs. your own config (probably a cache issue?) so a new service makes sense as to why it just worked. for the future, i think your initial post had null values from prisma
you have to set both DATABASE_URL andDIRECT_URL environment variables in your Railway service settings so Prisma’s datasource block has non-empty values as required in Prisma’s docs
youll also need to lock your builder to the latest version by adding "builder": "railpack@latest" or "railpackVersion": "0.9.2" in railway.json. check railway's docs for build config