Cannot autowire service "jsonapi.file_upload": argument

Created on 25 June 2024, 2 months ago
Updated 28 June 2024, 2 months ago

Problem/Motivation

Symfony\Component\DependencyInjection\Exception\RuntimeException: Cannot autowire service "jsonapi.file_upload": argument "$fileUploadHandler" of method "Drupal\jsonapi\Controller\FileUpload::__construct()" references class "Drupal\file\Upload\FileUploadHandler" but no such service exists.

Encountered issue while testing against Drupal version 11.x-dev

See below:
D10.3.x (JsonAPI services): https://git.drupalcode.org/project/drupal/-/blob/10.3.x/core/modules/jso...
D11.x (JsonAPI services): https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/jsona...

Steps to reproduce

Run the kernel test with module jsonapi.

I got this error while working on the openapi_jsonapi

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Closed: works as designed

Version

11.0 🔥

Component
JSON API 

Last updated 1 day ago

Created by

🇮🇳India ankitv18

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

Comments & Activities

  • Issue created by @ankitv18
  • Status changed to Postponed: needs info 2 months ago
  • 🇺🇸United States cilefen

    Hello.

    I ran the jsonapi module's kernel tests with no errors in a Git working copy of branch 10.3.x:

    ../vendor/bin/phpunit modules/jsonapi/tests/src/Kernel
    PHPUnit 9.6.19 by Sebastian Bergmann and contributors.
    
    Testing /var/www/html/core/modules/jsonapi/tests/src/Kernel
    ...............................................................  63 / 119 ( 52%)
    ........................................................        119 / 119 (100%)
    
    Time: 01:11.367, Memory: 6.00 MB
    

    Drupal\file\Upload\FileUploadHandler exists in Drupal and it is a service. This but report needs more detailed steps to reproduce.

  • Status changed to Needs work 2 months ago
  • 🇮🇳India ankitv18

    Updated the detail actually it causing in 11.x

  • Status changed to Postponed: needs info 2 months ago
  • 🇺🇸United States cilefen

    Drupal tests itself all the time and 11.x is passing. In what setup on your end is this failing?

  • 🇺🇸United States cilefen

    I also ran the jsonapi module kernel tests manually, specifically on the 11.x branch, and they pass. I did this in DDEV in a new site install.

  • Status changed to Closed: works as designed 2 months ago
  • 🇮🇳India ankitv18

    Thanks @cilefen for testing proactively.

    I debugged within that module and Figured out, actually it happens because this argument $fileUploadHandler is referencing the file module interface and from D11 onwards if jsonapi is included in the protected $modules = ['jsonapi'] then it needs to be updated by $modules = ['file', 'jsonapi']

Production build 0.71.5 2024