Dom
Dom

Reputation: 3436

laravel deployment failed on heroku

Some months ago I succeeded in deploying a Laravel 5.5 application on Heroku.

I tried to do the same today with a Laravel 6.12 application, and I have a lot of problems. I added the .env vars, I added the Procfile. But I have this error:

enter image description here

Did something change between Laravel 5.5 and 6 for deploying to Heroku? How can I get this working?

My post-install-cmd is:

"post-install-cmd": [
            "php artisan cache:clear",
            "php artisan config:cache",
            "chmod -R 777 storage",
            "php artisan passport:keys"
        ]

Upvotes: 1

Views: 362

Answers (1)

Chris
Chris

Reputation: 137238

You're using the default file session driver, but this isn't a good fit on Heroku. Its filesystem is ephemeral and local to each dyno.

Try using a different session driver by setting the SESSION_DRIVER environment variable:

heroku config:set SESSION_DRIVER=cookie

cookie is probably simplest, but memcached or redis would work well too if you have either of those set up.

The default session driver didn't change between Laravel 5.5 and 6, but I wouldn't recommend using file with Laravel 5.5 on Heroku either.

Upvotes: 3

Related Questions