Deployment error: error 7 while downloading … port 443: Connection refused

This article provides a fix for the issue when deployment fails with the following error message:

W: In CurlDownloader.php line 370:
W:
W:   curl error 7 while downloading https://repo.packagist.org/p2/magento/module
W:   -sitemap.json: Failed to connect to repo.packagist.org port 443: Connection
W:    refused

Affected versions

Adobe Commerce on cloud infrastructure, all supported versions

Issue

Deployment fails with a curl error 7 message.

Steps to reproduce:

Trigger a deployment.

Expected behavior:

Deployment is successful.

Actual behavior:

Deployment fails, and the following error: curl error 7 while downloading … port 443: Connection refused appears in the deploy log.

Cause

This might be due to the cache connection being lost to the repo.

Solution

Ask a Super User on the project to run this command:

magento-cloud project:clear-build-cache -p <project ID>

To check who on the project is a Super User, refer to View a user’s project role in the Commerce on Cloud Infrastructure Guide.

recommendation-more-help
8bd06ef0-b3d5-4137-b74e-d7b00485808a