This article talks about the causes and solutions for the Adobe Commerce on cloud infrastructure issue, where the build phase of the deployment process fails, and the error message is summarized with: “Error building project: The build hook failed with status code 1”.
Steps to reproduce:
Trigger the deployment manually or by performing a merge, push, or synchronization of your environment.
Deployment is completed successfully.
There are multiple reasons why environment building fails. Usually, in the deployment log, you will see a long error message, where the first part would be more specific regarding the reason, and the conclusion would be “Error building project: The build hook failed with status code 1. Aborted build”.
Looking closer at the first problem-specific part will help you to identify the issue. Here are the most common ones, and the next section provides solutions for them:
The following paragraphs provide some more details.
Directories to be considered for clean up:
For details on how to increase disk space if you are on the Adobe Commerce on cloud infrastructure Starter plan architecture, see the Increase disk space for Integration environment on cloud. The same instructions can be used for increasing space of Adobe Commerce on cloud infrastructure Pro plan architecture Integration environment. For Pro Production/Staging, you need to file a ticket to Adobe Commerce Support, and request increased disk space. But it is monitored by Platform. But typically, you will not have to deal with this on the Staging/Production of Pro architecture as Adobe Commerce monitors these parameters for you and alerts you and/or takes actions according to the contract.
Ensure that build hooks are defined properly in the
magento.app.yaml file. If you are on Adobe Commerce 2.2.X, building hooks should be defined as follows:
# We run build hooks before your application has been packaged. build: | php ./vendor/bin/ece-tools build # We run deploy hook after your application has been deployed and started. deploy: | php ./vendor/bin/ece-tools deploy
Use the Upgrade to ece-tools article for reference.
Ensure that ECE-tools package is present in the
composer.lock file by running the following command:
If they are specified, the response would look like the following example:
“name”: “magento/ece-tools”’ composer.lock
bash "name": "magento/ece-tools", "version": "2002.0.20",
See the Upgrade to ece-tools article for reference.
If it is the applied patch that is preventing the environment from building successfully, you will see something similar to the following in the deploy log:
%patch_name%.composer.patch [2019-02-19 18:12:59] CRITICAL: .... [2019-02-19 18:12:59] CRITICAL: Command git apply --check --reverse /app/m2-hotfixes/%patch_name%.composer.patch returned code 1 ... W: W: Command git apply --check --reverse /app/m2-hotfixes/%patch_name%.composer.patch returned code 1 W: W: W: build ... E: Error building project: The build hook failed with status code 1. Aborted build.
These error messages mean that the patch you are trying to apply either was created for a different Adobe Commerce version or has conflicts with your customizations or previously applied patches. Try to resolve the conflict or contact Adobe Commerce Support.
If it is the custom extension that is preventing the environment to build successfully, you will see the custom module(s) name(s) mentioned in the deployment log, along with the particular conflict caused by this module. Resolve the conflict or contact the extension developers for the solution.
Commit and push your changes. This will trigger the deployment automatically.