I've created a Laravel app locally. (This is working fine)
After, deployed that app to AWS Elastic Beanstalk with a .zip file. (This is working fine)
Then, created a simple pipeline using AWS CodePipeline to grab data from a particular GitHub repo and deploy to that specific AWS Elastic Beanstalk environment. I see that any push I make to that particular repo, the CodePipeline does then deploy to that particular AWS Elastic Beanstalk environment.
The problem is that the instance now has
with the following Recent Event
Environment health has transitioned from Warning to Severe. 100.0 % of the requests are failing with HTTP 5xx. ELB processes are not healthy on all instances. Application restart completed 42 seconds ago and took 7 seconds. ELB health is failing or not available for all instances. One or more TargetGroups associated with the environment are in a reduced health state: - awseb-AWSEB-CVIEEN5EVRFC - Warning
and if I go to its URL I get a
500 | SERVER ERROR
Based on the comments.
The issue was caused by missing .env
file in the deployment package/artifact that CodePipeline deploys. This was caused by the file not being committed into the GitHub repository.
To determine the cause, the CodePipeline's artifact was inspected. The artifact can be found in CodePipeline's bucket or in EB Application versions (in the Source column) and it is an objects a random name without an extension. In OP's case it was S40pAMw
. It should be noted that this object is just a zip
file without extension. To inspect it content, adding the extension to the download object allowed for straight forward opening of the zip
archive.
(Please see @JackPrice-Burns answer for alternative way of dealing with env variables).
The solution was to commit the missing file into the repository. Once that was done, the CodePipeline was triggered
and once the deployment finished the Health of the Elastic Beanstalk instance changed to Ok
and the 500 | SERVER ERROR was now gone