Hi, is there any change about `DATABASE_URL` loca...
# orm-help
m
Hi, is there any change about
DATABASE_URL
located in schema.prisma file from prisma 2.30.0 to 3.2.1? I'm using NestJS with prisma and now when I try to start the app is throwing an error, and before to upgrade it didn't happen.. My app when starts get the variable from consul but it seems that prisma requires before to load the app..
r
@Martí Crespí 👋 This seems to be just an env variable missing error so it’s not related to the upgrade. Can you log the environment var and check if it’s present?
m
When the app starts the first step is go to consul and get&set the env variables, so now with 3.2.1 the app need the variable before to start, I had the app in 2.30.0 for a few months and this way was not a problem..
I have the DATABASE_URL with a .env file and only I need it locally when I do a
prisma generate
or a
prisma db pull
but when I upload to production with docker always was setted by the first step (consul) when the app starts, now it seems that it need before..
r
Where are you deploying your app?
m
To a docker container..
r
I would then suggest the following options: 1. Pass the env variable to the container directly before it starts 2. Pass it directly to PrismaClient in the following manner
m
Yes, in my company we are using kubernetes to inject some variables, but this one is dinamic, for that reason we get from consul, because we are reading the config if something has changed every hour.. I will take a look to the second point..
But in 3.2.1 something has changed..jeje
Copy code
PrismaClientInitializationError: error: Environment variable not found: DATABASE_URL.
  -->  schema.prisma:12
I create the nest app. AFTER the ok from Parse function from Consul, I start the app, now this error is throwing before the ok because if I set a breakpoint where it's trying to get the variable this error is already in the console.. Perhaps in the new version has introduced this particulary check..
@Ryan do you know if it would be possible to put this env variable check optional?
r
@Martí Crespí I don’t think so. It would be best to create a feature request with your use case so that we can look into this. Also best to load the env variable before starting the app or dynamically adding it to
PrismClient
.
m
Ok, thanks!
👍 1