Unable to add and install a module via the drupal.org (json:api) source type

Created on 5 July 2024, 6 months ago
Updated 24 July 2024, 5 months ago

Problem/Motivation

With the Allow installing via UI option checked and Drupal.org (JSON:API) enabled, if I then click the Add and Install button for one of the projects with the Drupal.org (JSON:API) tab active I run into the following error.

title: Error while installing FreeAgent API
body: Cannot download drupalorg_jsonapi/drupal-freeagent-freeagent from any available source

I first tried on an install of drupal 11.x with automatic updates 3.1.x-dev and project browser 2.0.x-dev. With Drupal 11.x I was uncertain if the modules presented were even Drupal 11 ready. On d.o itself if you switch the "works with" select field to drupal 11 and search for "pathauto" you get pathauto presented as the first result, even though no version of "pathauto" is supporting Drupal 11 yet (see https://www.drupal.org/project/project_module?f%5B0%5D=&f%5B1%5D=&f%5B2%... โ†’ )
Therefore I was unsure if the error was due to picking a module that is not supporting Drupal 11 yet or due to a general issue with the endpoint in combination with the composer functionality in project browser. I went ahead and installed a site with Drupal 10.3.1 (with the recommend-project composer template) , automatic updates 3.1.x-dev and project browser 2.0.x-dev, with the same setup as outlined before for Drupal 11.x. I run into the exact same error when i try to add and install a module on Drupal 10.3.1.

Steps to reproduce

Proposed resolution

๐Ÿ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

๐Ÿ‡ฉ๐Ÿ‡ชGermany rkoller Nรผrnberg, Germany

Live updates comments and jobs are added and updated live.
  • Starshot blocker

    A potential blocker for Drupal Starshot. More information: http://www.drupal.org/project/starshot

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @rkoller
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States chrisfromredfin Portland, Maine

    In InstallerController.php, it seems like Installing is hard-coded to only support drupalorg_mockapi:

        // @todo Expand to support other plugins in https://drupal.org/i/3312354.
        $source = $this->enabledSourceHandler->getCurrentSources()['drupalorg_mockapi'] ?? NULL;
        if ($source === NULL) {
          return new JsonResponse(['message' => "Cannot download $project->id from any available source"], 500);
        }
        if (!$source->isProjectSafe($project)) {
          return new JsonResponse(['message' => "$project->machineName is not safe to add because its security coverage has been revoked"], 500);
        }
    

    However, also of note is that $project->id is displayed in that error message, and looks pretty messed up:

    Cannot download drupalorg_jsonapi/drupal-starrating-starrating from any available source

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States chrisfromredfin Portland, Maine

    @phenaproxima is going to look at this soon (next day or two)

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States chrisfromredfin Portland, Maine

    actually this should block alpha

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    Yeah -- that line needs to be axed, frankly. Should have been removed when the real endpoint was promoted to a full source!

  • Merge request !543Remove hard-coded nonsense โ†’ (Merged) created by phenaproxima
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany rkoller Nรผrnberg, Germany

    rkoller โ†’ changed the visibility of the branch 3459288-unable-to-add to hidden.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany rkoller Nรผrnberg, Germany

    rkoller โ†’ changed the visibility of the branch 3459288-unable-to-add to active.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    That said, we are doing some kind of testing of it, so let's keep it for now but wrap it in an if check.

  • Pipeline finished with Canceled
    6 months ago
    Total: 429s
    #221087
  • Pipeline finished with Success
    6 months ago
    Total: 405s
    #221089
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany rkoller Nรผrnberg, Germany

    As already written over on the conversation on slack, tested on a fresh install of 10.3.1. installed with composer, then composer required package manager and project browser only. then went into the project browser folder and added the MR543 and switched to the feature branch. enabled the ui install and tested with the star rating module. The module got successfully installed now via the json api source type. from a manual testing perspective that looks fully functional now. thank you!

  • Pipeline finished with Skipped
    6 months ago
    #221121
  • Status changed to Fixed 6 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States chrisfromredfin Portland, Maine

    since this was worked on and tested and RTBC'd, I'll ship it!

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

Production build 0.71.5 2024