Drupal.org JSON API modules endpoint returns a 400 error when requested by the Project browser

Created on 25 January 2025, 28 days ago

Problem/Motivation

The Project browser can't longer receive the module list from Drupal.org JSON API endpoint.

Steps to reproduce

Go to the Drupal admin page > Extend > Browse.

Expected behavior:
A list of modules is displayed

Actual behavior:
The error is thrown: Client error: `GET https://www.drupal.org/jsonapi/index/project_modules?filter...

Error details:
400 Bad Request, `field_supporting_organizations`,`field_supporting_organizations.field_supporting_organization`,`field_module_categories`,`field_maintenance_status`,`field_development_status`,`uid`,`field_project_images` are not valid relationship names. Possible values: node_type, revision_uid, uid, menu_link, field_development_status, field_maintenance_status, field_project_images, upload, field_project_docs, field_replaced_by, field_module_categories, field_project_ecosystem

Note: You may not see the error if you have a successful response that was previously cached. The easy way to reset the endpoint response cache is to change the project browser config on the settings page (/admin/config/development/project_browser), save it, and change it back.

Proposed resolution

The issue is caused by include=field_supporting_organizations,field_supporting_organizations.field_supporting_organization,field_module_categories,field_maintenance_status,field_development_status,uid,field_project_images parameter in request, added in fetchProjects method of /src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php

As the endpoint responds it is not supported value.
So it has to be either adjusted on the module side or the Drupal.org JSON API modules endpoint side.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡ͺGeorgia iamdroid

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @iamdroid
  • πŸ‡¬πŸ‡ͺGeorgia iamdroid
  • πŸ‡©πŸ‡ͺGermany rogerpfaff Munich

    I was testing Drupal CMS with project browser and got it working. Testing project browser itself on a Drupal 11 site freshly installed fails with a bad request because of securty_coverage filter. If I exclude the filter I get this exact error described here.

    Changing and saving project browser settings does not help in my setup.

  • πŸ‡ͺπŸ‡ΈSpain lluvigne Seville, Spain

    Hello!

    Same happened to me while testing a fresh instalation of Drupal CMS. I investigated a bit the project browser code, and seems that the relationship included here is not permitted in the Drupal.org API.

    After removing the field_supporting_organizations,field_supporting_organizations.field_supporting_organization from the include it worked fine again.

    So the question is: should project browser remove these relationships? Or maybe Drupal.org changed something that needs to be adjusted?

  • πŸ‡¬πŸ‡ͺGeorgia iamdroid

    Thanks @lluvigne , that is the question, indeed. I quickly checked the project_browser module code and haven't found any trace of using the data from field_supporting_organizations, so it seems to me it is not critical for the module to work, but leaving it to project maintainers to comment on it.

  • πŸ‡¬πŸ‡ͺGeorgia jibla
  • Merge request !682Remove unsupported filter options. β†’ (Merged) created by Unnamed author
  • πŸ‡©πŸ‡ͺGermany rogerpfaff Munich

    If you need this as a patch in your composer download it from thhis url https://git.drupalcode.org/project/project_browser/-/merge_requests/682....

  • Pipeline finished with Failed
    28 days ago
    Total: 430s
    #405782
  • πŸ‡ΊπŸ‡ΈUnited States drumm NY, US

    This is likely due to migrations on the new.drupal.org site, which is still very much unstable. They should be resolved next week, although data for this field may take some time to migrate again.

    field_supporting_organizations is a paragraph field and the paragraphs migration got jumbled enough to justify deleting all data for the field and starting a fresh migration.

    The Drupal.org APIs that project browser uses should still be considered unstable. There was a plan to mitigate this and improve error handling in project browser, but that apparently didn't happen.

    I haven't found an issue to improve the error handling around Drupal.org responses that should have been opened. Drupal.org will make breaking changes to the API over time, and 4xx errors should be handled better. The usual recommendation will be to upgrade project browser, although in this case it is likely an unplanned API change.

    ✨ Display warnings/errors from DrupalOrgJsonApi backend Active was done, so we can set up that warning soon.

  • First commit to issue fork.
  • πŸ‡ͺπŸ‡ΈSpain fjgarlin

    field_supporting_organizations was a field not used by Project Browser and that should not have been in the filter.

    I knew that it wasn't used in the front-end but totally forgot that it was still in the code. The MR by @rogerpfaff fixed the immediate issue (thanks!), I'm now just trying to fix the tests.

  • Pipeline finished with Failed
    28 days ago
    Total: 524s
    #406023
  • Pipeline finished with Success
    28 days ago
    Total: 409s
    #406027
  • πŸ‡ͺπŸ‡ΈSpain fjgarlin

    I've manually tested the MR in Drupalpod and it works (commenting out line DrupalDotOrgJsonApi.php:295 as we've temporary put a warning error on the d.o endpoint until this is merged).

    Tests are also green (that's the part I just updated).
    This is RTBC and ready to be merged. A new release should probably be created after this.

  • Pipeline finished with Skipped
    28 days ago
    #406081
  • First commit to issue fork.
  • πŸ‡ΊπŸ‡ΈUnited States chrisfromredfin Portland, Maine

    thanks for the work, weekend warriors!

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

  • Pipeline finished with Canceled
    2 days ago
    Total: 393s
    #429682
  • Pipeline finished with Failed
    2 days ago
    Total: 505s
    #429689
  • Pipeline finished with Skipped
    2 days ago
    #429697
  • Pipeline finished with Failed
    2 days ago
    Total: 1266s
    #429695
Production build 0.71.5 2024