lundi 21 décembre 2020

Laravel is not reading environmental variables on AWS Lambda

Laravel deployment on AWS Lambda using bref/serverless.

Error message:

production.ERROR: SQLSTATE[HY000] [2002] Connection refused (SQL:...

This is a database connection error but I think this is because Laravel is not reading environmental variables.

This:

Route::get('/', function () {
    return env('APP_NAME');
});

returns nothing although APP_NAME is set and works properly on a local computer.

I'm not sure where the .env file is located on AWS Lambda and how to check it (other than the test above) if it is properly transferred to AWS Lambda.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire