beyondcode / herd-community

88 stars 1 forks source link

[Bug]: curl error 23 when composer updating or installing from certain repos #662

Closed glaarg-robert closed 5 months ago

glaarg-robert commented 6 months ago

Platform

macOS

Operating system version

macOS Sonoma 14.4.1

System architecture

ARM64 (M1, M2, etc)

Herd Version

1.6.0

PHP Version

No response

Bug description

In CurlDownloader.php line 389:

[Composer\Downloader\TransportException] curl error 23 while downloading https://filament-filter-sets.composer.sh/download/XXXX/advanced-tables-for-filament-3.6.15.zip: Failed writing received data to disk/application

This apparently is an issue with curl version that herd is using but herd uses its own versions of different binaries. On a regular install apparently using brew doing a brew reinstall curl fixes the issue but when using herd this does not work. I even went so far as to install curl with brew and placing that PATH at the start so even running a "which curl" showed the brew version of curl but that did not work either.

Steps to reproduce

composer update

Relevant log output

22/31 [===================>--------]  70% 2 secs  - Downloading archilex/filament-filter-sets (3.6.15)
 28/31 [=========================>--]  90% 3 secs  - Downloading archilex/filament-filter-sets (3.6.15)
 29/31 [==========================>-]  93% 6 secs  - Downloading archilex/filament-filter-sets (3.6.15)
 31/31 [============================] 100% 8 secs
In CurlDownloader.php line 389:

  [Composer\Downloader\TransportException]
  curl error 23 while downloading https://filament-filter-sets.composer.sh/download/XXXXXXX/advanced-tables-for-filament-3.6.15.zip: Failed writing received data to disk/application

Exception trace:
  at phar:///Users/robert/Library/Application Support/Herd/bin/composer/src/Composer/Util/Http/CurlDownloader.php:389
 Composer\Util\Http\CurlDownloader->tick() at phar:///Users/robert/Library/Application Support/Herd/bin/composer/src/Composer/Util/HttpDownloader.php:392
 Composer\Util\HttpDownloader->countActiveJobs() at phar:///Users/robert/Library/Application Support/Herd/bin/composer/src/Composer/Util/Loop.php:88
 Composer\Util\Loop->wait() at phar:///Users/robert/Library/Application Support/Herd/bin/composer/src/Composer/Installer/InstallationManager.php:430
 Composer\Installer\InstallationManager->waitOnPromises() at phar:///Users/robert/Library/Application Support/Herd/bin/composer/src/Composer/Installer/InstallationManager.php:286
 Composer\Installer\InstallationManager->downloadAndExecuteBatch() at phar:///Users/robert/Library/Application Support/Herd/bin/composer/src/Composer/Installer/InstallationManager.php:218
 Composer\Installer\InstallationManager->execute() at phar:///Users/robert/Library/Application Support/Herd/bin/composer/src/Composer/Installer.php:821
 Composer\Installer->doInstall() at phar:///Users/robert/Library/Application Support/Herd/bin/composer/src/Composer/Installer.php:646
 Composer\Installer->doUpdate() at phar:///Users/robert/Library/Application Support/Herd/bin/composer/src/Composer/Installer.php:292
 Composer\Installer->run() at phar:///Users/robert/Library/Application Support/Herd/bin/composer/src/Composer/Command/UpdateCommand.php:251
 Composer\Command\UpdateCommand->execute() at phar:///Users/robert/Library/Application Support/Herd/bin/composer/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar:///Users/robert/Library/Application Support/Herd/bin/composer/vendor/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at phar:///Users/robert/Library/Application Support/Herd/bin/composer/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at phar:///Users/robert/Library/Application Support/Herd/bin/composer/src/Composer/Console/Application.php:385
 Composer\Console\Application->doRun() at phar:///Users/robert/Library/Application Support/Herd/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///Users/robert/Library/Application Support/Herd/bin/composer/src/Composer/Console/Application.php:145
 Composer\Console\Application->run() at phar:///Users/robert/Library/Application Support/Herd/bin/composer/bin/composer:93
 require() at /Users/robert/Library/Application Support/Herd/bin/composer:29
mpociot commented 6 months ago

Can you share your composer.json so I can reproduce this locally?

glaarg-robert commented 6 months ago

Unfortunately this is a paid package. I am happy to share the composer.json but it would most likely not do any good for you.

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The skeleton application for the Laravel framework.",
    "keywords": [
        "laravel",
        "framework"
    ],
    "license": "MIT",
    "require": {
        "php": "^8.2",
        "ext-fileinfo": "*",
        "ext-imagick": "*",
        "ext-openssl": "*",
        "ext-zip": "*",
        "althinect/filament-spatie-roles-permissions": "^2.2",
        "archilex/filament-filter-sets": "^3.5",
        "ariaieboy/filament-currency": "^1.2",
        "bjeavons/zxcvbn-php": "^1.3",
        "cheesegrits/filament-phone-numbers": "3.x-dev",
        "croustibat/filament-jobs-monitor": "^2.2.0",
        "filament/filament": "^3.0-stable",
        "flowframe/laravel-trend": "^0.2.0",
        "guzzlehttp/guzzle": "^7.2",
        "http-interop/http-factory-guzzle": "^1.2",
        "lab404/laravel-impersonate": "^1.7.5",
        "laravel-notification-channels/twilio": "^3.3",
        "laravel/framework": "^11.0",
        "laravel/pulse": "^1.0@beta",
        "laravel/sanctum": "^4.0",
        "laravel/scout": "^10.6",
        "laravel/tinker": "^2.8",
        "league/flysystem-ftp": "^3.0",
        "livewire/livewire": "^3.1",
        "masbug/flysystem-google-drive-ext": "^2.2",
        "meilisearch/meilisearch-php": "^1.5",
        "pxlrbt/filament-activity-log": "^1.0",
        "pxlrbt/filament-excel": "^2.3",
        "rawilk/laravel-settings": "^3.3",
        "revolution/laravel-google-sheets": "^6.2",
        "spatie/laravel-activitylog": "^4.7",
        "spatie/laravel-backup": "^8.4",
        "spatie/laravel-discord-alerts": "^1.3",
        "spatie/laravel-ray": "^1.33",
        "spatie/laravel-tail": "^4.4",
        "stechstudio/filament-impersonate": "^3.8",
        "theiconic/name-parser": "^1.2",
        "whitecube/laravel-timezones": "*"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.9",
        "fakerphp/faker": "^1.9.1",
        "jeroenzwart/laravel-csv-seeder": "^1.6",
        "laravel/pint": "^1.0",
        "laravel/sail": "^1.18",
        "mockery/mockery": "^1.4.4",
        "orangehill/iseed": "^3.0",
        "phpunit/phpunit": "^10.1",
        "spatie/laravel-ignition": "^2.0"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        },
        "files": [
            "app/Helpers/Helpers.php",
            "app/Helpers/DebugHelper.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi",
            "@php artisan filament:upgrade"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "pestphp/pest-plugin": true,
            "php-http/discovery": true
        }
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://filament-filter-sets.composer.sh"
        },
        {
            "type": "vcs",
            "url": "https://github.com/XXXX/filament-phone-numbers"
        }
    ],
    "minimum-stability": "beta",
    "prefer-stable": true
}

Kenneth Sese the owner of this package mentioned Anystack so I am gonna assume he is using that service to host this package.

glaarg-robert commented 6 months ago

Was able to solve it temporarily anyway doing the following...

Installed php8.2 via Herd.

rm ~/Library/Application\ Support/Herd/bin/php
ln -s ~/Library/Application\ Support/Herd/bin/php82 ~/Library/Application\ Support/Herd/bin/php

Run the composer update or install what ever you normally are doing that is failing.

rm ~/Library/Application\ Support/Herd/bin/php
ln -s ~/Library/Application\ Support/Herd/bin/php83 ~/Library/Application\ Support/Herd/bin/php

That will do the composer work and switch back to php8.3.

mpociot commented 6 months ago

So the problem only exists with PHP 8.2?

BTW: no need to symlink manually. You can change the globally used PHP version in the MenuBar, which will rewrite the symlink

glaarg-robert commented 6 months ago

The problem only exists with php8.3 you have to switch back to php8.2 to get around the issue.

Looking all through the Herd app I see where you can install certain versions of PHP but you can only change which PHP version per site on the Sites tab but that does not change PHP for the command line unless I am missing a different option someplace. Or maybe I need to source a file I am not aware of to reload something?

The work around I posted above worked for me but for others if you have an easier way that would be great to post here. I am no Herd expert so I may just be missing it.

maxibue commented 6 months ago

Was able to solve it temporarily anyway doing the following...

Installed php8.2 via Herd.

rm ~/Library/Application\ Support/Herd/bin/php
ln -s ~/Library/Application\ Support/Herd/bin/php82 ~/Library/Application\ Support/Herd/bin/php

Run the composer update or install what ever you normally are doing that is failing.

rm ~/Library/Application\ Support/Herd/bin/php
ln -s ~/Library/Application\ Support/Herd/bin/php83 ~/Library/Application\ Support/Herd/bin/php

That will do the composer work and switch back to php8.3.

Sadly that doesn't seem to work on Windows 11. But I fixed it this way:

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.

craigvc commented 6 months ago

Yeh same issues on private repos

craigvc commented 6 months ago

@mpociot any news on this?

craigvc commented 6 months ago

The problem exists in windows also so you actually have to go to 8.1 in windows in herd (which is a big issues for my team as we have to remove half our dependencies just to install half a project, 8.2 in mac - @mpociot the issue is identified as the curl version and I think the issue has to be with php 8.3 / 8.2 and curl 8.7.1. So I assume downgrading to 3.6.6 uses php 8.2 which then allows curl 8.6 to run. - how can we make herd use that version? Big problem for me as i paid for team licence and team are stuck!!

mpociot commented 6 months ago

On Windows, all we do is download the official PHP binaries that php.net provides, so this feels like it's a curl issue not solved there? We don't manually configure or deal with anything curl related on Windows

craigvc commented 6 months ago

On Windows, all we do is download the official PHP binaries that php.net provides, so this feels like it's a curl issue not solved there? We don't manually configure or deal with anything curl related on Windows

Its also on mac but you can downgrade to 8.2 in mac to get around it

mpociot commented 6 months ago

I am currently publishing a new PHP update, which fixes this issue and will be available via the in-app updater.

dixi83 commented 6 months ago

Is it possible the issue still persists? running Herd on Windows 11 and also facing error 23 on private repo's...

mpociot commented 5 months ago

This is now fixed with the latest PHP and Herd versions

craigvc commented 5 months ago

The issue still exists on windows 11 new install of Herd @mpociot

craigvc commented 5 months ago

@mpociot whilst I appreciate the complexities of this, I have paid for a team licence. Half my team are on windows and all still have issues with the curl23 error. So much so many have switched to back to laragon. Is this issue getting resolved?

mpociot commented 5 months ago

We published a new version of Herd (1.6.1) yesterday, which updated composer to the latest version, which fixes this.

The issue was also fixed by composer a couple of days ago, which you can manually get by running "composer self-update"

realnsleo commented 4 months ago

Still facing this issue today, Herd v1.6.1 running PHP8.3.7

image

Had to revert back to WSL2. Any other tips?

dennissvu commented 4 months ago

I have the same issue with the latest (1.7.2) version of Herd and composer. It has something to do with the PHP version. When I use Laragon with 8.2 it is fine.

ProgrammerZ commented 2 months ago

Same issue. Win 10, Herd v1.9.0, curl 8.7.1. Rolling back to PHP 8.2 solved the issues.