InterNACHI / modular

Modularize your Laravel application
MIT License
759 stars 63 forks source link

composer update modules/my-module giving error #92

Open sagar-patona opened 5 months ago

sagar-patona commented 5 months ago

getting following error Composer\Util\Http\RequestProxy::__construct(): Argument #2 ($auth) must be of type ?string, array given, called in phar:///usr/local/bin/composer/src/Composer/Util/Http/ProxyManager.php on line 102

image

Versions PHP:8.2 composer:2.4

ahinkle commented 5 months ago

We can't help you without code examples or a repo reproduction.

LauHypershop commented 4 months ago

I had this issue as well.

In my case the cause was that I was running development inside a docker environment (DDEV) that had composer/composer 2.7.2 installed globally in the container, while this package installed composer/composer 2.7.6 locally in the project.

If you look closely at the top of the stack trace you see that at some point the global composer makes a call to the local composer, but those two versions are not quite compatible.

In RequestProxy.php line 40:

  [TypeError]                                                                                                                                                                                             
  Composer\Util\Http\RequestProxy::__construct(): Argument #2 ($auth) must be of type ?string, array given, called in phar:///usr/local/bin/composer/src/Composer/Util/Http/ProxyManager.php on line 103  

Exception trace:
  at /var/www/html/vendor/composer/composer/src/Composer/Util/Http/RequestProxy.php:40
 Composer\Util\Http\RequestProxy->__construct() at phar:///usr/local/bin/composer/src/Composer/Util/Http/ProxyManager.php:103
 Composer\Util\Http\ProxyManager->getProxyForRequest() at phar:///usr/local/bin/composer/src/Composer/Util/Http/CurlDownloader.php:249

I was able to get past the issue by ensuring the container's global composer/composer version and the project's local composer/composer version were exactly the same.

BrianHenryIE commented 3 months ago

I'm getting the same error when running a workflow on GitHub Actions – nothing to do with this project, but it's the only search result. I've been working on a Composer plugin, brianhenryie/composer-fallback-to-git, which is probably involved since most projects wouldn't have anything in vendor/composer except their autoload files.

As LauHypershop pointed out, the backtrace uses both the Composer phar:/// and the vendor/composer/composer/src/ files.

I'll update this thread if I figure out a solution.

In RequestProxy.php line 40:

  [TypeError]                                                                  
  Composer\Util\Http\RequestProxy::__construct(): Argument #2 ($auth) must be  
   of type ?string, array given, called in phar:///usr/local/bin/composer/src  
  /Composer/Util/Http/ProxyManager.php on line 103                             

Exception trace:
  at /home/runner/work/bh-wp-slswc-client/bh-wp-slswc-client/vendor/composer/composer/src/Composer/Util/Http/RequestProxy.php:40
 Composer\Util\Http\RequestProxy->__construct() at phar:///usr/local/bin/composer/src/Composer/Util/Http/ProxyManager.php:103
 Composer\Util\Http\ProxyManager->getProxyForRequest() at phar:///usr/local/bin/composer/src/Composer/Util/Http/CurlDownloader.php:249
 Composer\Util\Http\CurlDownloader->initDownload() at phar:///usr/local/bin/composer/src/Composer/Util/Http/CurlDownloader.php:140
 Composer\Util\Http\CurlDownloader->download() at phar:///usr/local/bin/composer/src/Composer/Util/HttpDownloader.php:341
 Composer\Util\HttpDownloader->startJob() at phar:///usr/local/bin/composer/src/Composer/Util/HttpDownloader.php:299
 Composer\Util\HttpDownloader->addJob() at phar:///usr/local/bin/composer/src/Composer/Util/HttpDownloader.php:110
 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:209
 Composer\Repository\ComposerRepository->findPackage() at /home/runner/work/bh-wp-slswc-client/bh-wp-slswc-client/vendor/brianhenryie/composer-fallback-to-git/src/FallbackPlugin.php:51
 BrianHenryIE\ComposerFallbackToGit\FallbackPlugin->activate() at phar:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php:392
 Composer\Plugin\PluginManager->addPlugin() at phar:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php:296
 Composer\Plugin\PluginManager->registerPackage() at phar:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php:470
 Composer\Plugin\PluginManager->loadRepository() at phar:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php:101
 Composer\Plugin\PluginManager->loadInstalledPlugins() at phar:///usr/local/bin/composer/src/Composer/Factory.php:443
 Composer\Factory->createComposer() at phar:///usr/local/bin/composer/src/Composer/Factory.php:629
 Composer\Factory::create() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:520
 Composer\Console\Application->getComposer() at phar:///usr/local/bin/composer/src/Composer/Command/BaseCommand.php:127
 Composer\Command\BaseCommand->tryComposer() at phar:///usr/local/bin/composer/src/Composer/Command/BaseCommand.php:240
 Composer\Command\BaseCommand->initialize() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:264
 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
LauHypershop commented 3 months ago

Yeah I recently had it in another environment as well, and then it turned out my global composer install was lagging behind the project's composer version. Self-update fixed it.

On Sun, 23 Jun 2024 at 00:56, Brahmic @.***> wrote:

Try composer self-update. I solved this case upgrading Composer to version 2.7.7

— Reply to this email directly, view it on GitHub https://github.com/InterNACHI/modular/issues/92#issuecomment-2184228946, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATPE3SV7YZDSWIAJTML5YRLZIX6J7AVCNFSM6AAAAABG5FNMMGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBUGIZDQOJUGY . You are receiving this because you commented.Message ID: @.***>