1

I've been developing Laravel app and deploying regularly to an Elastic Beanstalk instance without issue, but suddenly, and without warning, deployments have begun to fail.

Obviously I immediately wondered what I might have changed in the code to cause this, but I haven't made any changes to the core configuration. I rolled back to an earlier commit just to make sure it wasn't my code, and I got the same error.

It's failing after I run eb deploy and running the .ebextensions configs.

Here's the error message from the logs:

[2018-01-08T10:50:34.672Z] INFO  [9457]  : Running 4 of 5 actions: EbExtensionPostBuild... 
[2018-01-08T10:50:35.523Z] ERROR [9457]  : Command execution failed: Activity failed. (ElasticBeanstalk::ActivityFatalError) caused by:   

In Connection.php line 664:
     SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = custom and table_name
= migrations)

     In Connector.php line 67:
     SQLSTATE[HY000] [2002] Connection refused

      (ElasticBeanstalk::ExternalInvocationError)

The DB connection credentials are absolutely correct (and haven't changed either).

The command that it's attempting when it fails is simply:

php artisan migrate --force

I've tried connecting over SSH to the server, and I can manually run the same command without issue.

I just can't understand why the deployment is suddenly having its connection refused. Could it be something to do with the AWS security configuration? Could it expire or something? :-/

1 Answer 1

3

It turns out the issue was caused by local settings becoming cached and then deployed to the server in: bootstrap/cache/config.php.

Clearing the cache with php artisan config:clear deleted the file and solved the problem.

Sign up to request clarification or add additional context in comments.

1 Comment

This worked! You saved my life! :D I've searched for says and only old posts keep coming up. For anyone else trying to fix it, I also noticed that if you're logged in as root (e.g. ec2-user), running php artisan config:clear might not delete the file. Try to manually remove the config files from the cache directory: sudo rm -f ./bootstrap/cache/config.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.