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

composer update modules/my-module giving error #92

Open
sagar-patona opened this issue Apr 28, 2024 · 4 comments
Open

composer update modules/my-module giving error #92

sagar-patona opened this issue Apr 28, 2024 · 4 comments

Comments

@sagar-patona
Copy link

sagar-patona commented Apr 28, 2024

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
Copy link

ahinkle commented Apr 29, 2024

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

@LauHypershop
Copy link

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
Copy link

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
Copy link

LauHypershop commented Jun 25, 2024 via email

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

No branches or pull requests

4 participants