Closed L4znet closed 6 months ago
What do you think could be the fix?
@L4znet Just had the same while pulling a branch locally from one of my developers and wondered a bit about the real problem, until I realized I did not create the .env
file.
@thetutlage Not sure it's clearer, but would a simple mention like this do the trick ?
EnvValidationException: Validation failed for one or more environment variables
Missing environment variable "DB_DATABASE"
Did you create `.env` file and corresponding variables ?
Perhaps with a link to the env
documentation ?
I think this is how Next.js CLI handle such cases if I recall correctly
There could be many cases because of which an environment variable is missing.
.env
file during development..env
file and hence the suggestion will confuse in thinking that you must create this file.I think the issue is quite straight forward and does not need additional tooling or context
When you start the project, all credentials are not defined by default, that pretty logic..
But, if we look at the behavior of Laravel (for example) you can create a new app and not define any credentials in env vars, that's because Laravel define by default the database name as "Laravel" to prevent the error
In my opinion, for a beginner that wanna test if all works that's more friendly to say nothing and just send a error if he try to make a database request (because the default credentials are not correct..)
otherwise, why not explain that behavior in the doc by saying something like "Hey, just before you launch your app please be sure to setup the database credentials"
or, another solution is to give the possibility to fill the database name directly from the cli..
Package version
6.8.0
Describe the bug
Hey everyone!
I'm not sure if this can be considered as an issue, but every time I try to create a new app, I get an error in my terminal saying that an environment variable is missing.
So, yeah, I just need to set the variable, but in my opinion, it can be confusing for a beginner.
The entire message :
Have a good day
Reproduction repo
No response