Adobe Commerce on cloud repo could not be accessed: 403 Forbidden or 404 Not Found error when deploying
This article discusses how to resolve the Adobe Commerce on cloud infrastructure failed deployment error similar to the following:
"The ‘https://repo.magento.com/archives/magento/magento-cloud-configuration/magento-magento-cloud-configuration-x.x.x.x.zip’ URL could not be accessed: HTTP/1.1 403 Forbidden ". Or the “https://repo.magento.com/archives/magento/module-customer-segment/magento-module-customer-segment-102.0.5.0-patch2.zip" file could not be downloaded (HTTP/1.1 404 Not Found)”.
Affected products and versions
- Adobe Commerce on cloud infrastructure 2.2.x, 2.3.x, and 2.4.x
Issue
Error message on deployment indicating the repo URL could not be accessed.
Steps to reproduce
Trigger deployment manually or by performing a merge, push, or synchronization of your environment.
Actual result
Deployment gets stuck. In the deployment error log in the Project UI, an error message similar to the following is displayed:
“The ‘https://repo.magento.com/archives/magento/magento-cloud-configuration/magento-magento-cloud-configuration-x.x.x.x.zip’ URL could not be accessed: HTTP/1.1 [403 Forbidden or 404 Not Found]”.
(Click the “Failure” icon in the Project UI to see the log.)
Expected result
Deployment is completed successfully.
Cause
The error is caused by the authorization keys (access keys) being not valid, not specified or not specified correctly.
Some of the reasons for keys being not valid are:
- You generated the keys using your shared account.
- Your license was previously revoked due to payment issues.
Solution
Take the following steps to solve the issue with the authorization keys (see the sections below for more details on each step):
- Obtain the valid authorization keys (skip this if you are absolutely sure your key is valid).
- Add the keys value in the
env:COMPOSER_AUTH
variable (or make sure that the correct value is there) and check if the keys are specified consistently in the variable on the project level and environment level as well as theauth.json
file (if it exists) in the project root. - Update or delete
auth.json
, to have a single place where the key is configured, if the authorization keys values are not specified or have an other value.
1. Obtain valid authorization keys
If you were using the keys created under the shared account, you need to contact the Adobe Commerce license owner who provides you access and request they generate the keys for you.
If your license was previously revoked due to payment issues, and you have resolved those issues and your license was renewed, you need to generate the new authentication keys.
2. Add the keys value in the env:COMPOSER_AUTH variable and check if the same keys are specified in auth.json
See the instructions and related information in Prepare your existing system and Add authentication keys in our developer documentation.
3. Update or delete auth.json
Following is a step by step description of how to update your authorization keys:
-
Log in to the machine that has your Adobe Commerce on cloud infrastructure SSH keys.
-
Log in to your project:
magento-cloud login
-
Create a branch to update the code (in the following example the branch name is
auth
is created from the primary branch):magento-cloud environment:branch auth master
-
Change to the project root directory.
-
Optional: Delete the
auth.json
if you prefer and continue to step 9. -
Open
auth.json
in a text editor.code language-json { "http-basic": { "repo.magento.com": { "username": "<public_key>", "password": "<private_key>" } } }
-
Add the correct authentication keys.
-
Save your changes and exit the text editor.
-
Commit and merge your changes:
git add -A
git commit -m "<message>"
git push origin master
-
Wait for the project to deploy.