fresh install - prisma db:push fails when using .env.development & .env.production

Previous T3 apps I've created an .env.development and .env.production file and prisma has worked fine.
Setup a fresh install of T3 today and while db:push works if I have the environment file named simply as .env, as soon as I change to having .env.development and .env.production, it reports the following error:
Prisma schema loaded from prisma/schema.prisma
Datasource "db": MySQL database
Error: Prisma schema validation - (get-config wasm)
Error code: P1012
error: Environment variable not found: DATABASE_URL.
--> schema.prisma:14
|
13 | // https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#string
14 | url = env("DATABASE_URL")
|

Validation Error Count: 1
[Context: getConfig]

Prisma CLI Version : 5.13.0
Prisma schema loaded from prisma/schema.prisma
Datasource "db": MySQL database
Error: Prisma schema validation - (get-config wasm)
Error code: P1012
error: Environment variable not found: DATABASE_URL.
--> schema.prisma:14
|
13 | // https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#string
14 | url = env("DATABASE_URL")
|

Validation Error Count: 1
[Context: getConfig]

Prisma CLI Version : 5.13.0
I've not edited env.js other than to add some additional environmental variables. Any suggestions?
Solution:
npm
dotenv-cli
A global executable to run applications with the ENV variables loaded by dotenv. Latest version: 7.4.1, last published: 2 months ago. Start using dotenv-cli in your project by running npm i dotenv-cli. There are 232 other projects in the npm registry using dotenv-cli.
Jump to solution
2 Replies
Solution
GStudiosX2
GStudiosX28mo ago
npm
dotenv-cli
A global executable to run applications with the ENV variables loaded by dotenv. Latest version: 7.4.1, last published: 2 months ago. Start using dotenv-cli in your project by running npm i dotenv-cli. There are 232 other projects in the npm registry using dotenv-cli.
WeiKaiLe
WeiKaiLeOP8mo ago
Thank you, I've edited the "db:push" script and that has worked.
Want results from more Discord servers?
Add your server