While deploying a monorepo app with turbo build on vercel, there are erros about accessing the env vars. On local It can access the env var in .env.local, however on vercel platform it suddenly stopped working and started complaining about it.
all env variables are set in the dashboard
but during build it it fails to access the env variables.
Why it can't access whose env vars?
If you are using prisma in a Turborepo and trying to deploy to Vercel and you are seeing the error: Environment Variable not found: DATABASE_URL, you need to add DATABASE_URL to the turbo.json environment variables
If you want tasks to remain cached,
"globalPassThroughEnv": ["DATABASE_URL"],
or if you want tasks to miss cache when var is updated
"globalEnv": ["DATABASE_URL"],
or maybe you only want it available during build
"tasks": {
"build": {
"env": ["DATABASE_URL"]
}
}