4 months ago
I'm trying to deploy a monorepo with pnpm workspaces and nextJS web app.
The database is in packages/db, and I'm trying to use drizzle-kit to run migrations upon app start.
For some reason, it doesn't pick up on any of my environment variables, and it fails because it cannot find my DATABASE_URL.
I've spent way to much time on this, and it doesn't seem to be anything on my side. This is stupid. It shouldn't be this hard to deploy an app on railway.
Here's my railway.json:
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "RAILPACK",
"watchPatterns": [
"apps/web/**",
"packages/**",
"turbo.json",
"package.json",
"pnpm-lock.yaml",
"pnpm-workspace.yaml",
"railpack.json",
"railway.json"
]
},
"deploy": {
"numReplicas": 1,
"sleepApplication": false,
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10,
"startCommand": "pnpm db:migrate --filter=@lg-monorepo/db && pnpm --filter=web start"
}
}
2 Replies
4 months ago
Hey there! We've found the following might help you get unblocked faster:
🧵 Issue with Environment Variables in Docker Images from [ghcr.io](ghcr.io) in NextJS Project
🧵 Critical Issue: Environment variables not being passed to deployment (Trial Plan)
If you find the answer from one of these, please let us know by solving the thread!
4 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 noahd • 4 months ago
4 months ago
Hi,
This likely won't fix your issue but I'd like to note that migration steps belong in pre-deploy steps.