Cache clear throws error when pushing Symfony5-app to Heroku

Viewed 173

I'm trying to deploy my Symfony-5 Application with Heroku and followed the official guide.

But when I try to deploy with git push heroku master, I get the following error:

remote:        Script cache:clear returned with error code 255
    remote:        !!  PHP Fatal error:  Uncaught Symfony\Component\Dotenv\Exception\PathException: Unable to read the "/tmp/build_274cd58d/.env" environment file. in /tmp/build_274cd58d/vendor/symfony/dotenv/Dotenv.php:505
    remote:        !!  Stack trace:
    remote:        !!  #0 /tmp/build_274cd58d/vendor/symfony/dotenv/Dotenv.php(60): Symfony\Component\Dotenv\Dotenv->doLoad()
    remote:        !!  #1 /tmp/build_274cd58d/vendor/symfony/dotenv/Dotenv.php(80): Symfony\Component\Dotenv\Dotenv->load()
    remote:        !!  #2 /tmp/build_274cd58d/config/bootstrap.php(17): Symfony\Component\Dotenv\Dotenv->loadEnv()
    remote:        !!  #3 /tmp/build_274cd58d/bin/console(30): require('/tmp/build_274c...')
    remote:        !!  #4 {main}
    remote:        !!    thrown in /tmp/build_274cd58d/vendor/symfony/dotenv/Dotenv.php on line 505
    remote:        !!

I have already set my .env file to production mode and updated the vendors for production.

It seems like the .env-file can't be found. I'm not sure but maybe it has something to do with these generated build-directories like "build_274cd58d". I also checked if my .env-file is in the gitignore, but it isn't.

0 Answers
Related