Pub/errors files not syncing from remote repository in Adobe Commerce on Cloud Infrastructure
In Adobe Commerce on Cloud Infrastructure, pub/errors files on staging and production instances do not reflect the latest version from the remote repository. This issue occurs when deployment processes restore or overwrite files during environment builds, which prevents direct file changes from persisting on cloud instances. To fix this, you must synchronize these files correctly by using the supported patch-based deployment flow.
Description description
Environment
Adobe Commerce on Cloud Infrastructure
Issue/Symptoms
- Files under
pub/errorson Adobe Commerce on Cloud Infrastructure instances do not reflect the latest versions from the remote repository. - Comparing file contents over SSH shows that
pub/errorsfiles on staging or production differ from those in Git. - Customizations made directly to
pub/errorsfiles on the instance are lost or reverted after each deployment.
Cause
In Adobe Commerce Cloud, some files are not project-owned in the same way as custom modules or themes. Adobe Commerce base packages, Composer-managed dependencies, or deployment-time tooling supply these files, and cloud deployment can recreate or overwrite them.
During deployment, Adobe Commerce Cloud uses ece-tools together with Cloud Patches for Commerce and the Quality Patches Tool to build and prepare the codebase. The system applies pending patches in the following order:
- Required Commerce patches from Cloud Patches for Commerce
- Selected optional patches from the Quality Patches Tool
- Custom patches from
m2-hotfixes, applied in alphabetical order by patch name
As a result, deployment can restore, rebuild, or overlay files supplied by Adobe Commerce packages or Composer-managed dependencies. If you customize these files outside the supported patch flow, the next deployment replaces those changes.
Resolution resolution
During deployment, Adobe Commerce on Cloud Infrastructure applies patches in a defined order. After required Commerce patches and selected optional patches are processed, the deployment applies custom patches from the m2-hotfixes directory. This process ensures that your customization is consistently re-applied during every deployment.
To persist changes to Adobe Commerce-managed or Composer-managed files, follow these steps:
- Create a custom patch for the required change.
- Place the patch in
m2-hotfixesat the project root. - Commit and push the patch file.
- Redeploy the environment.