OS: MacOS Catalina 10.15.3
Webserver: Localhost (nginx/1.17.9 from Valet Plus
PHP Version: 7.3.11 (from Valet Plus)
Drupal Version: 9.0.0-beta3

Just tried installing D9 beta3 with Composer using the command composer create-project drupal/recommended-project:9.0.0-beta3 and got the following error:

- Installing drupal/core-composer-scaffold (9.0.0-beta3):

  [ErrorException]
  stream_context_create(): options should have the form ["wrappername"]["optionname"] = $value

The composer installation cannot continue after this.

The installation works as intended if I switch to using beta2.

Comments

James Byng created an issue. See original summary.

xjm credited Mixologic.

xjm credited drumm.

xjm credited hestenet.

xjm’s picture

Priority: Normal » Major

Thanks for reporting this. I got the same error when I tested the beta after the release.

There are a couple workarounds we tried:

  1. Run it first with --no-install, then try again.
  2. Delete composer.lock and vendor, then composer install,

Several Composer initiative contributors and DA staff looked into the problem and have a potential fix to deploy.

Adding some credits for folks who discussed the issue.

xjm’s picture

alexpott’s picture

Here's the debug backtrace

 () at phar:///Users/alex/dev/bin/composer/src/Composer/Util/StreamContextFactory.php:153
 Composer\Util\ErrorHandler::handle() at n/a:n/a
 stream_context_create() at phar:///Users/alex/dev/bin/composer/src/Composer/Util/StreamContextFactory.php:153
 Composer\Util\StreamContextFactory::getContext() at phar:///Users/alex/dev/bin/composer/src/Composer/Util/RemoteFilesystem.php:300
 Composer\Util\RemoteFilesystem->get() at phar:///Users/alex/dev/bin/composer/src/Composer/Util/RemoteFilesystem.php:89
 Composer\Util\RemoteFilesystem->copy() at phar:///Users/alex/dev/bin/composer/src/Composer/Downloader/FileDownloader.php:153
 Composer\Downloader\FileDownloader->doDownload() at phar:///Users/alex/dev/bin/composer/src/Composer/Downloader/FileDownloader.php:97
 Composer\Downloader\FileDownloader->download() at phar:///Users/alex/dev/bin/composer/src/Composer/Downloader/ArchiveDownloader.php:38
 Composer\Downloader\ArchiveDownloader->download() at phar:///Users/alex/dev/bin/composer/src/Composer/Downloader/ZipDownloader.php:77
 Composer\Downloader\ZipDownloader->download() at phar:///Users/alex/dev/bin/composer/src/Composer/Downloader/DownloadManager.php:216
 Composer\Downloader\DownloadManager->download() at phar:///Users/alex/dev/bin/composer/src/Composer/Installer/LibraryInstaller.php:197
 Composer\Installer\LibraryInstaller->installCode() at phar:///Users/alex/dev/bin/composer/src/Composer/Installer/LibraryInstaller.php:101
 Composer\Installer\LibraryInstaller->install() at phar:///Users/alex/dev/bin/composer/src/Composer/Installer/PluginInstaller.php:60
 Composer\Installer\PluginInstaller->install() at phar:///Users/alex/dev/bin/composer/src/Composer/Installer/InstallationManager.php:173
 Composer\Installer\InstallationManager->install() at phar:///Users/alex/dev/bin/composer/src/Composer/Installer/InstallationManager.php:160
 Composer\Installer\InstallationManager->execute() at phar:///Users/alex/dev/bin/composer/src/Composer/Installer.php:597
 Composer\Installer->doInstall() at phar:///Users/alex/dev/bin/composer/src/Composer/Installer.php:229
 Composer\Installer->run() at phar:///Users/alex/dev/bin/composer/src/Composer/Command/CreateProjectCommand.php:195
 Composer\Command\CreateProjectCommand->installProject() at phar:///Users/alex/dev/bin/composer/src/Composer/Command/CreateProjectCommand.php:145
 Composer\Command\CreateProjectCommand->execute() at phar:///Users/alex/dev/bin/composer/vendor/symfony/console/Command/Command.php:245
 Symfony\Component\Console\Command\Command->run() at phar:///Users/alex/dev/bin/composer/vendor/symfony/console/Application.php:835
 Symfony\Component\Console\Application->doRunCommand() at phar:///Users/alex/dev/bin/composer/vendor/symfony/console/Application.php:185
 Symfony\Component\Console\Application->doRun() at phar:///Users/alex/dev/bin/composer/src/Composer/Console/Application.php:267
 Composer\Console\Application->doRun() at phar:///Users/alex/dev/bin/composer/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar:///Users/alex/dev/bin/composer/src/Composer/Console/Application.php:106
 Composer\Console\Application->run() at phar:///Users/alex/dev/bin/composer/bin/composer:61
 require() at /Users/alex/dev/bin/composer:24

This occurs on both Composer 1.9.2 and 1.10.6

It does not occur with beta2

The difference in the composer -vvv output at the point of failure...

  - Installing drupal/core-composer-scaffold (9.0.0-beta3): Using GitHub token authentication

Failed: [ErrorException] 0: stream_context_create(): options should have the form ["wrappername"]["optionname"] = $value
  - Installing drupal/core-composer-scaffold (9.0.0-beta2): Using GitHub token authentication
Downloading https://api.github.com/repos/drupal/core-composer-scaffold/zipball/bc6d4b20be795a3993ecfa72750c5b1c2832775e
Downloading (connecting...)
Following redirect (2) https://codeload.github.com/drupal/core-composer-scaffold/legacy.zip/bc6d4b20be795a3993ecfa72750c5b1c2832775e
Downloading https://codeload.github.com/drupal/core-composer-scaffold/legacy.zip/bc6d4b20be795a3993ecfa72750c5b1c2832775e
Downloading (100%)
 Extracting archiveExecuting command (CWD): unzip -qq  '/Users/alex/dev/test/recommended-project/vendor/drupal/core-composer-scaffold/390fc51b0b01b74f8b99ebd9eec625d6' -d '/Users/alex/dev/test/recommended-project/vendor/composer/9c05e849'
Loading plugin Drupal\Composer\Plugin\Scaffold\Plugin
  - Installing drupal/core-project-message (9.0.0-beta2): Downloading https://api.github.com/repos/drupal/core-project-message/zipball/5984bad5e53782a946cccfab14deda84bef7d190
Downloading (connecting...)

The beta3 release is on https://github.com/drupal/core-composer-scaffold/releases

alexpott’s picture

Places on the internet where such a composer error has come up before with respect to composer:

alexpott’s picture

And here's the change from beta2 to beta3 for the scaffold plugin.

diff --git a/composer/Plugin/Scaffold/composer.json b/composer/Plugin/Scaffold/composer.json
index 5cbb4ad79b..ca9d6d7b48 100644
--- a/composer/Plugin/Scaffold/composer.json
+++ b/composer/Plugin/Scaffold/composer.json
@@ -6,7 +6,7 @@
   "homepage": "https://www.drupal.org/project/drupal",
   "license": "GPL-2.0-or-later",
   "require": {
-    "composer-plugin-api": "^1.0.0",
+    "composer-plugin-api": "^1 || ^2",
     "php": ">=7.3.0"
   },
   "conflict": {

Note at the failure point no drupal code has run. So it looks like this is being caused by a change to one of the composer.json files or something in packaging for the beta release. And given that composer create-project drupal/recommended-project:9.0.x-dev uses pretty much the same composer.json files and works this looks either to be something to do with packaging or to do with how Drupal\Composer\Composer::generateMetapackages() updates the composer.jsons for releases.

drumm’s picture

Mixologic spotted that sections like

"transport-options": {
  "relative": false
},

were recently appearing in lockfile generation.

For all of the things that were path repositories. That does not exist in the other lockfiles, and looks like whatever puts that in there on the composer side is buggy, because you cant have an option that is “false” like that.

I added a cleanup for this to the lockfile generator: https://bitbucket.org/drupalorg-infrastructure/subtree-splitter/commits/... that is being deployed now.

drumm’s picture

That is now deployed, and the lockfile generator has run for 9.0.x, regenerating things like https://github.com/drupal/recommended-project/blob/9.0.x/composer.lock

The best way to test right now is double checking that no other issues exist in installing 9.0.x via Composer.

We have the ability to regenerate these for 9.0.0-beta3 and move the tags in the project templates, or we can wait for 9.0.0-beta4. Moving the tags might not be effective for everyone due to caching.

drumm’s picture

Status: Active » Needs review

We have the ability to regenerate these for 9.0.0-beta3 and move the tags in the project templates, or we can wait for 9.0.0-beta4.

This is done and this started working for me. I did run composer clearcache

xjm’s picture

Status: Needs review » Fixed

RC1 worked today with no further DA interventions, so I think we can call this fixed. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.