Component deployment failure

This topic discusses how to recover from a failed component deployment. Typical examples include components that have dependencies that are not met by your environment, such as incompatible PHP versions.

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

  • Restore a snapshot
  • Remove the component from the composer.json and redeploy the environment

Clean, remove, and redeploy

To clean up from the previous deployment, you must log in to the remote environment and manually clear the contents of the Magento var directory. And then you must remove the component from the composer.json file in your local environment and redeploy.

To clean the var directories:

  1. On your local workstation, change to the Cloud project root directory.

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

    1
    
    magento-cloud environment:ssh
    
  3. Clear the var directories.

    1
    
    rm -rf var/*
    

To remove the component:

  1. On your local workstation, change to the Cloud project root directory.

  2. Clear the cache.

    1
    
    composer clear-cache
    
  3. Remove the component from the composer.json file.

    1
    
    composer remove <component-name>:<version>
    

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

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

  5. Add, commit, and push code changes.

    1
    
    git add -A
    
    1
    
    git commit -m "<message>"
    
    1
    
    git push origin <environment-ID>