ÃÛ¶¹ÊÓÆµ

Static content fails to generate on ÃÛ¶¹ÊÓÆµ Commerce on Cloud infrastructure

Static content fails to generate during deployment on ÃÛ¶¹ÊÓÆµ 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

ÃÛ¶¹ÊÓÆµ Commerce on Cloud infrastructure

Issue/Symptoms

  • Static content does not generate during deployment.
  • Error displayed: Cannot create a symlink for “/app/…/.htaccessâ€.
  • deployed_version.txt file is missing or outdated.
  • Inconsistent CLEAN_STATIC_FILES variable across environments.

Resolution resolution

To resolve the issue, follow these steps:

  1. Check the CLEAN_STATIC_FILES variable 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.yaml file 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/variables to inspect the variable.

  2. Compare the CLEAN_STATIC_FILES variable across environments to identify discrepancies (for example, enabled in staging but disabled in production) and adjust it to enabled to ensure consistency.

  3. Push changes to the environment to trigger a rebuild and regenerate static content.

  • CLEAN_STATIC_FILES in the ÃÛ¶¹ÊÓÆµ Commerce on Cloud infrastructure guide.
  • variable list in the ÃÛ¶¹ÊÓÆµ Commerce on Cloud infrastructure guide.
recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f