Failed to parse dotenv file due to an invalid name. Failed at [* Application In Production! *] #1652

Closed
opened 2026-02-05 01:31:01 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @Zeigren on GitHub (Apr 15, 2020).

I'm testing out upgrading/installing 0.29.0 using my docker stack but when I run either php artisan key:generate or php artisan migrate I get the error

Failed to parse dotenv file due to an invalid name. Failed at [*     Application In Production!     *].,
The environment file is invalid!

I'm not sure exactly what dotenv file it's referring to since none of the ones I create have a line that includes [* Application In Production! *]. This is using php-7.4-fpm and you can find my docker stack here if that helps.

Originally created by @Zeigren on GitHub (Apr 15, 2020). I'm testing out upgrading/installing 0.29.0 using my docker stack but when I run either `php artisan key:generate` or `php artisan migrate` I get the error ```bash Failed to parse dotenv file due to an invalid name. Failed at [* Application In Production! *]., The environment file is invalid! ``` I'm not sure exactly what dotenv file it's referring to since none of the ones I create have a line that includes `[* Application In Production! *]`. This is using php-7.4-fpm and you can find my docker stack [here](https://github.com/Zeigren/docker-swarm-bookstack) if that helps.
Author
Owner

@ssddanbrown commented on GitHub (Apr 15, 2020):

Hi @Zeigren,

That's odd, Almost sounds like the output of one of the artisan commands is ending up as the content of the .env file.

Just to confirm, is this going from a v0.28.x release to v0.29? Or at least did your same scripts work for v0.28 without issue?

@ssddanbrown commented on GitHub (Apr 15, 2020): Hi @Zeigren, That's odd, Almost sounds like the output of one of the artisan commands is ending up as the content of the .env file. Just to confirm, is this going from a v0.28.x release to v0.29? Or at least did your same scripts work for v0.28 without issue?
Author
Owner

@Zeigren commented on GitHub (Apr 15, 2020):

Yep 0.28.3 works great and is what I'm currently running on my website. Only change I'm making to my stack is the version number.

@Zeigren commented on GitHub (Apr 15, 2020): Yep 0.28.3 works great and is what I'm currently running on my website. Only change I'm making to my stack is the version number.
Author
Owner

@ssddanbrown commented on GitHub (Apr 15, 2020):

@Zeigren Just played about with your setup. Built an image from the dockerfile using:

docker build --build-arg BRANCH=release --build-arg VERSION=v0.29.0 .

Then, once built, ran it interactively with:

docker run -it --entrypoint /bin/sh <image>

Was then able to copy the .env.example to .env inside the container and run php artisan key:generate and have it work as expected. So I'd expect this to be something happening in/after the entry-point scripts.

Could it be that php artisan key:generate will prompt due to being in production mode? It has the output:

**************************************
*     Application In Production!     *
**************************************

 Do you really wish to run this command? (yes/no) [no]:
 > yes

which aligns with the message. Maybe adding the --force flag to that command, as you already have with the migrate command, would fix this?

@ssddanbrown commented on GitHub (Apr 15, 2020): @Zeigren Just played about with your setup. Built an image from the dockerfile using: ```bash docker build --build-arg BRANCH=release --build-arg VERSION=v0.29.0 . ``` Then, once built, ran it interactively with: ```bash docker run -it --entrypoint /bin/sh <image> ``` Was then able to copy the `.env.example` to `.env` inside the container and run `php artisan key:generate` and have it work as expected. So I'd expect this to be something happening in/after the entry-point scripts. Could it be that `php artisan key:generate` will prompt due to being in production mode? It has the output: ``` ************************************** * Application In Production! * ************************************** Do you really wish to run this command? (yes/no) [no]: > yes ``` which aligns with the message. Maybe adding the `--force` flag to that command, as you already have with the migrate command, would fix this?
Author
Owner

@Zeigren commented on GitHub (Apr 15, 2020):

Ugh yep it was an issue with the entry-point script. During the process of creating the .env file with cat it inadvertently ran the line # Run php artisan key:generate to generate a valid key., the output of which was added to the environment file... Sorry for not catching that, not sure why that wasn't a problem before.

@Zeigren commented on GitHub (Apr 15, 2020): Ugh yep it was an issue with the entry-point script. During the process of creating the .env file with `cat` it inadvertently ran the line `# Run php artisan key:generate to generate a valid key.`, the output of which was added to the environment file... Sorry for not catching that, not sure why that wasn't a problem before.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1652