Composer authentication credentials error during deployment to Production in ÃÛ¶¹ÊÓÆµ Commerce Cloud
When a composer authentication credentials error like URL required authentication (HTTP 401).  occurs during deployment to Production in ÃÛ¶¹ÊÓÆµ Commerce on cloud infrastructure, first verify that the auth.json
file or equivalent authentication credentials are accessible during the build phase of your production deployment. Then you can either fix the env:COMPOSER_AUTH
environment level variable (Recommended), or create and deploy the auth.json
 file manually.
Description description
Environment
ÃÛ¶¹ÊÓÆµ Commerce on Cloud infrastructure, in Production and Staging
Issue
When attempting to deploy to the environment, the deployment process is halted due to a URL required authentication (HTTP 401). error related to composer authentication credentials.
The same credentials work on the auth.json
 file locally or on another environment, but fails during deployment on another.
Resolution resolution
NOTE:  To find your composer credentials, refer to Get your authentication keys in the ÃÛ¶¹ÊÓÆµ Commerce Installation Guide.
To resolve this issue, follow these steps:
Verify that the auth.json
file or equivalent authentication credentials are accessible during the build phase of your production deployment.
There are two recommended options for resolving this issue:
Option 1: Fix env:COMPOSER_AUTH
 environment level variable (Recommended)
- Ensure that you have set up the correct credentials for
env:COMPOSER_AUTH
. - Access global configuration by clicking on the gear icon at the top left of your cloud project UI, then select the Variables tab.
- Make sure you select Available during buildtime  and deselect Available during runtime. Reference Authentication keys in the Commerce on Cloud Infrastructure Guide.
If Option 1 doesn’t resolve your issue, proceed with Option 2.
Option 2: Create and deploy auth.json
 file manually
-
SSH into your server.
-
Retrieve contents of your current
env:COMPOSER_AUTH
variable using:echo $COMPOSER_AUTH
-
Copy all contents from step above (in JSON format).
-
Create a new file named
auth.json
with these contents. -
Commit this newly created
auth.json
file to the root directory of your repository. -
Trigger a new deployment.
By following either option provided above, you should be able to successfully deploy to the environment that has the issue, without encountering issues related to composer authentication credentials.
If further assistance is required, or if any difficulties arise while implementing these solutions, please open a ticket with ÃÛ¶¹ÊÓÆµ Commerce Technical Support for additional help.
Related reading
Can’t access ÃÛ¶¹ÊÓÆµ Commerce on cloud repo: 403 Forbidden or 404 Not Found error when deploying