Recover from component failure

This topic discusses how to recover if a component fails to deploy properly. Typical examples include components that have dependencies that are not met by your remote environment, such as incompatible PHP versions.

You can recover from a failed deployment in any of the following ways:

Clean, remove, and redeploy

To clean up from the previous deployment, identify the component that was added or updated and then remove it. First, log in to the remote environment and manually clear the contents of the var directory. Then remove the component from the composer.json file and redeploy the environment.

To clean the var directories:

  1. On your local workstation, change to your project directory.

  2. Use SSH to log in to the remote environment.

    code language-bash
    magento-cloud ssh
    
  3. Clear the var directories.

    code language-shell
    rm -rf var/*
    
  4. Log out.

To remove the component:

  1. On your local workstation, change to your project directory.

  2. Clear the cache.

    code language-bash
    composer clear-cache
    
  3. Remove the component from the composer.json file.

    code language-bash
    composer remove <component-name>:<version>
    

    If the following message displays, you do not need to do anything further:

    code language-none
    Package "<name>:<version>" listed for update is not installed. Ignoring.
    
  4. Wait while the dependencies are updated.

  5. Add, commit, and push code changes.

    code language-bash
    git add -A
    
    code language-bash
    git commit -m "<message>"
    
    code language-bash
    git push origin <environment-ID>
    
WARNING
The deployment process begins when you perform a merge, push, or synchronization of your environment, or when you trigger a manual redeployment, during which the Commerce application is in maintenance mode. For a Production environment, Adobe recommends completing this work during off-peak hours to avoid service disruptions.

See more about restoring an environment without a backup in Restore an environment.

TIP
For help with stuck deployments, use the Adobe Commerce deployment troubleshooter in the Commerce Help Center.
recommendation-more-help
05f2f56e-ac5d-4931-8cdb-764e60e16f26