Closed heymartinadams closed 3 months ago
I don't think an easy workaround exists currently, this will have to be built as its own feature :D
Out of curiosity, do you inject the database URL at runtime then?
That would be cool! I'm only interested in how you're supplying the database URL to Prisma at build time :D
We inject the database URL at build time via a custom build script. Inside that build script, the database URL variable gets created dynamically: Doppler CLI gets installed and run, then the NextJS build command is called using that dynamically-created variable. Here’s what happens:
// Packages
import shell from 'shelljs'
// This is run on Vercel
const ScriptBuild = async () => {
shell.exec(
`(curl -Ls https://cli.doppler.com/install.sh || wget -qO- https://cli.doppler.com/install.sh) | sh`
)
const env = process.env.ENV
const token = `DOPPLER_TOKEN_` + env.toUpperCase()
shell.exec(`doppler setup --token ${process.env[token]} --config ${env}`)
shell.exec(`prisma generate --schema=./prisma/${env}/schema.prisma`)
shell.exec(`doppler run -- next build`)
}
ScriptBuild()
Describe the bug We use an environment variable manager (Doppler.com) rather than .env files. As such, our environment variable is currently not accessible to the Prisma Data Platform.
This obviously won’t let us use the Prisma Data Platform, since it cannot access our database.
Any solutions? Any workarounds?