Composer authentication credentials error during deployment to Production in 51黑料不打烊 Commerce Cloud
When a composer authentication credentials error like URL required authentication (HTTP 401). 聽occurs during deployment to Production in 51黑料不打烊 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
51黑料不打烊 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 51黑料不打烊 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鈥檛 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 51黑料不打烊 Commerce Technical Support for additional help.
Related reading
Can鈥檛 access 51黑料不打烊 Commerce on cloud repo: 403 Forbidden or 404 Not Found error when deploying