Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curl error 23 when updating custom repository #11913

Closed
cappuc opened this issue Mar 30, 2024 · 26 comments
Closed

curl error 23 when updating custom repository #11913

cappuc opened this issue Mar 30, 2024 · 26 comments
Labels

Comments

@cappuc
Copy link

cappuc commented Mar 30, 2024

Edit: How to Fix

Run brew reinstall curl to get the latest curl and fix this issue


Hi,

from yesterday composer started giving me this error when I'm using a custom repository:

curl error 23 while downloading https://<private-repo-url>/packages.json: Failed writing received data to disk/application

After many tries to fix this problem, I found that removing this line from CurlDownloader fixes the problem:

curl_setopt($curlHandle, CURLOPT_ENCODING, ""); // let cURL set the Accept-Encoding header to what it supports

I encountered this problem only on my mac, I tried with docker and it works.

Output of composer diagnose:

Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK git version 2.44.0
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: OK does not expire
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking Composer version: OK
Checking Composer and its dependencies for vulnerabilities: OK
Composer version: 2.7.2
PHP version: 8.3.4
PHP binary path: /opt/homebrew/Cellar/php/8.3.4/bin/php
OpenSSL version: OpenSSL 3.2.1 30 Jan 2024
cURL version: 8.7.1 libz 1.2.12 ssl (SecureTransport) OpenSSL/3.2.1
zip: extension present, unzip present, 7-Zip not available

When I run this command:

composer update --no-cache -v

I get the following output:

Loading composer repositories with package information

In CurlDownloader.php line 389:
                                                                                                                             
  [Composer\Downloader\TransportException]                                                                                   
  curl error 23 while downloading https://<private-repo-url>/packages.json: Failed writing received data to disk/application  
                                                                                                                             

Exception trace:
  at phar:///usr/local/bin/composer/src/Composer/Util/Http/CurlDownloader.php:389
 Composer\Util\Http\CurlDownloader->tick() at phar:///usr/local/bin/composer/src/Composer/Util/HttpDownloader.php:392
 Composer\Util\HttpDownloader->countActiveJobs() at phar:///usr/local/bin/composer/src/Composer/Util/HttpDownloader.php:363
 Composer\Util\HttpDownloader->wait() at phar:///usr/local/bin/composer/src/Composer/Util/HttpDownloader.php:114
 Composer\Util\HttpDownloader->get() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:1486
 Composer\Repository\ComposerRepository->fetchFile() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:1195
 Composer\Repository\ComposerRepository->loadRootServerFile() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:823
 Composer\Repository\ComposerRepository->hasProviders() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:484
 Composer\Repository\ComposerRepository->loadPackages() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/PoolBuilder.php:401
 Composer\DependencyResolver\PoolBuilder->loadPackagesMarkedForLoading() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/PoolBuilder.php:251
 Composer\DependencyResolver\PoolBuilder->buildPool() at phar:///usr/local/bin/composer/src/Composer/Repository/RepositorySet.php:326
 Composer\Repository\RepositorySet->createPool() at phar:///usr/local/bin/composer/src/Composer/Installer.php:495
 Composer\Installer->doUpdate() at phar:///usr/local/bin/composer/src/Composer/Installer.php:292
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:251
 Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:385
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:145
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:93
 require() at /usr/local/bin/composer:29
@CodeWithDennis
Copy link

I've encountered the same problem today, and I'm also using MacOS.

In CurlDownloader.php line 389:
curl error 23 while downloading https://redacted.pub/composer/packages.json: Failed writing received data to disk/application

@boris-glumpler
Copy link

boris-glumpler commented Apr 3, 2024

I'm also getting the same error on a new Mac M3 Pro. Satis repositories are not affected, tho, and install just fine.

My composer diagnose output is the same as @cappuc, except that I also have 7-Zip installed.

@jdecool
Copy link

jdecool commented Apr 3, 2024

I've the same error on one of my computers.

When I compare the composer diagnose, the problem seems to be related to the cURL version.

Works with cURL version: 8.6.0 libz 1.2.12 ssl (SecureTransport) OpenSSL/3.2.1 but not with cURL version: 8.7.1 libz 1.2.12 ssl (SecureTransport) OpenSSL/3.2.1

@jdecool
Copy link

jdecool commented Apr 3, 2024

After running brew reinstall curl on my machine, it seems the error disappear.

@boris-glumpler
Copy link

Disappeared for me as well after brew reinstall curl just now. I ran this a couple times yesterday, tho, and it didn't work then.

@cappuc
Copy link
Author

cappuc commented Apr 3, 2024

brew reinstall curl worked for me too.

@Seldaek
Copy link
Member

Seldaek commented Apr 3, 2024

Ok then looks like it's a curl or brew bug. I'll leave the issue open for now so people find it more easily, but I don't think we should act on it.

@Seldaek Seldaek added the Support label Apr 3, 2024
@ssx
Copy link

ssx commented Apr 3, 2024

I'm thankful I've found this - same issue for me today! Cheers for leaving open Jordi.

@sedattcom
Copy link

I've been having this problem for a week and I couldn't solve it.
I cannot update curl on the server where Whm is installed.
Do you have a different solution suggestion?

@ainigma32
Copy link

In our case we were able to downgrade cURL and after that we were able to use our satis repos but I would prefer a fix where we would not need to do this.
Is there any way to make cURL a little more verbose while using it through composer? That might give us some more information and maybe lead to an issue at the cURL repo

@craigvc
Copy link

craigvc commented Apr 13, 2024

issue is still there with reinstall curl

@riskihajar
Copy link

brew reinstall curl not working for me.

i'm using laravel herd btw.
i think the problem after herd update php 8.3, curl module using version 8.7.1.

for awhile i'm isolated to php8.2 which use curl 8.6.0 then run herd composer update its works ✅

@plompd
Copy link

plompd commented Apr 15, 2024

I also use Herd. No idea how to downgrade cUrl on a mac. Anyway, downgrading to version 3..6.6 is working. Then it is downloading...

@Seldaek
Copy link
Member

Seldaek commented Apr 15, 2024

@plompd version 3.6.6 of what software?

@plompd
Copy link

plompd commented Apr 15, 2024

Sorry, I thought I was on a specific package repo...
This was regarding installing a package in Laravel.

@temp
Copy link

temp commented Apr 18, 2024

Same problem here, on a M1 macbook with macports. Works with curl 8.6.0, fails with curl 8.7.1

@maximierung
Copy link

maximierung commented Apr 18, 2024

I had the same error on Windows 11, here's how I fixed it.

Run composer install on php8.3.

Change Herd to php8.1 (cURL 8.4.0) & run composer install --ignore-platform-reqs.

Then you should be fine, to change it back once all the installing is done, atleast I was.

If you don't have Herd just use a php version that uses the older curl versions.

@craigvc
Copy link

craigvc commented Apr 23, 2024

I had the same error on Windows 11, here's how I fixed it.

Run composer install on php8.3.

Change Herd to php8.1 (cURL 8.4.0) & run composer install --ignore-platform-reqs.

Then you should be fine, to change it back once all the installing is done, atleast I was.

If you don't have Herd just use a php version that uses the older curl versions.

thats not really a solution as some packages on our project need 8.2 or 8.3
@maximierung

@maximierung
Copy link

thats not really a solution as some packages on our project need 8.2 or 8.3 @maximierung

For me it worked since all the packages with the error didn't need it, but ig you're right tough. 👍

@mpociot
Copy link

mpociot commented Apr 24, 2024

For those of you who are curious why a brew reinstall fixes the issue despite no new version of curl being released: Homebrew manually applies this patch, which fixes the issue: curl/curl@b30d694

@pxlrbt
Copy link
Sponsor

pxlrbt commented Apr 27, 2024

@mpociot Is there also a fix when using herd composer? I guess that requires a new release for the PHP binary?

@Seldaek
Copy link
Member

Seldaek commented Apr 28, 2024

This is a curl regression in curl/curl@463472a meaning curl 8.7.0 and 8.7.1 are affected. 8.7.2 is planned to be released on May 22, 2024.

As that's kinda far off, and it seems to affect a bunch of people.. I tried to publish a workaround. Can someone affected please try if composer self-update --snapshot resolves it? I am not sure if hardcoding the Accept-Encoding header to gzip fixes it as well or if we really need to disable compression altogether.

Once confirmed I'll try to get a release out..

@pxlrbt
Copy link
Sponsor

pxlrbt commented Apr 28, 2024

Since reinstalling curl fixed this, I don't think I can test this 🙈

@zupolgec
Copy link

zupolgec commented May 1, 2024

This is a curl regression in curl/curl@463472a meaning curl 8.7.0 and 8.7.1 are affected. 8.7.2 is planned to be released on May 22, 2024.

As that's kinda far off, and it seems to affect a bunch of people.. I tried to publish a workaround. Can someone affected please try if composer self-update --snapshot resolves it? I am not sure if hardcoding the Accept-Encoding header to gzip fixes it as well or if we really need to disable compression altogether.

Once confirmed I'll try to get a release out..

This solved the issue for me, while reinstalling curl didn't work. Thanks @Seldaek

@fabianpnke
Copy link

This is a curl regression in curl/curl@463472a meaning curl 8.7.0 and 8.7.1 are affected. 8.7.2 is planned to be released on May 22, 2024.

As that's kinda far off, and it seems to affect a bunch of people.. I tried to publish a workaround. Can someone affected please try if composer self-update --snapshot resolves it? I am not sure if hardcoding the Accept-Encoding header to gzip fixes it as well or if we really need to disable compression altogether.

Once confirmed I'll try to get a release out..

This worked for me as well. Not like the curl reinstall.

@SamiQu
Copy link

SamiQu commented May 7, 2024

Om

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests