Static content fails to generate on Adobe Commerce on Cloud infrastructure
Static content fails to generate during deployment on Adobe Commerce on Cloud infrastructure, often due to misconfigured environment variables. Issues such as the error Cannot create a symlink for “/app/…/.htaccess” occurring during the build process, or a missing deployed_version.txt file, occur. To resolve the issue, ensure CLEAN_STATIC_FILES is enabled and redeploy the environment.
Description description
Environment
Adobe Commerce on Cloud infrastructure
Issue/Symptoms
- Static content does not generate during deployment.
- Error displayed: Cannot create a symlink for “/app/…/.htaccess”.
deployed_version.txtfile is missing or outdated.- Inconsistent
CLEAN_STATIC_FILESvariable across environments.
Resolution resolution
To resolve the issue, follow these steps:
-
Check the
CLEAN_STATIC_FILESvariable to ensure it’s set to enabled (or left unset, which defaults to enabled). You can verify this in any of the following ways:-
Access the server via SSH (for example, node 01) and run the following command:
code language-none php -r 'echo json_decode(base64_decode($_ENV[ "MAGENTO_CLOUD_VARIABLES"] ))->CLEAN_STATIC_FILES . "\n";' -
Check the
.magento.env.yamlfile in your repository for the variable. -
Run the following CLI command locally:
code language-none magento-cloud variables:list -p <clusterID> -
Visit the Cloud Console at
https://console.adobecommerce.com/username/<cluster ID>/<environment>/settings/variablesto inspect the variable.
-
-
Compare the
CLEAN_STATIC_FILESvariable across environments to identify discrepancies (for example, enabled in staging but disabled in production) and adjust it to enabled to ensure consistency. -
Push changes to the environment to trigger a rebuild and regenerate static content.
Related reading
- CLEAN_STATIC_FILES in the Adobe Commerce on Cloud infrastructure guide.
- variable list in the Adobe Commerce on Cloud infrastructure guide.