Lavarel Heroku 500 Error

UPDATE: 01/21/2024 - you can use the cli command to update these variables:

$ heroku config:set APP_KEY='base64:o9gwTlxCj4HJ39/Ubpx0...' // Get this from .env file in Laravel
$ heroku config:set APP_DEBUG='true'

Alternate fix:

To fix a 500 error on  your Laravel Application, follow these instructions:

This is because you have not setup the a key, we will setup the configurations with a command.

NOTE: you can get these values from the .env file.

heroku config:add APP_NAME=Laravel
heroku config:add APP_ENV=production
heroku config:add APP_KEY=[APP_KEY VALUE from .env]
heroku config:add APP_DEBUG=true
heroku config:add APP_URL=EXAMPLE.herokuapp.com

If you don't have any of these Key values, the main configuration causing the 500 error is the APP_DEBUG and APP_KEY - you must provide atleast these two to resolve the 500 error.

Or you can do this without a command with the following steps:

First thing to do is to go to your Heroku Dashboard:

https://dashboard.heroku.com/apps

a. click on the application name you just created
b. click on the settings tab
c. under the Config Vars section, click on the "Reveal Config Vars" button
d. Populate each field as follows from the .env file in your app

KEY: APP_KEY
VALUE: base64:3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
lick the "Add" button

NOTE: the APP_KEY can be found in your .env file


KEY: APP_DEBUG
VALUE: true
* Set to true so you can debug your app, otherwise, set to false on production apps

Refresh your browser to https://NAME_OF_APPLICATION.herokuapp.com/
This time you will see your application and not the 500 error