Type Hint Mismatch with FileUrlGenerator When Using pwa Module

Created on 14 November 2023, about 1 year ago
Updated 22 January 2024, 11 months ago

Problem/Motivation

When the cl_server module is enabled, installing or using the pwa module results in a type hint mismatch error. The ManifestConfigurationForm of the pwa module โ†’ expects a Drupal\Core\File\FileUrlGenerator object, but is receiving a Drupal\cl_server\FileUrlGenerator object instead.

Steps to reproduce

  1. Install and enable the cl_server module.
  2. Install and enable the pwa module.
  3. Attempt to access the manifest configuration form or a related feature of the pwa module.
  4. Observe the following error:
TypeError: Drupal\pwa\Form\ManifestConfigurationForm::__construct(): Argument #8 ($fileUrlGenerator) must be of type Drupal\Core\File\FileUrlGenerator, Drupal\cl_server\FileUrlGenerator given, called in /pwa/src/Form/ManifestConfigurationForm.php on line 140

Proposed resolution

It seems like the cl_server module may be overriding the file_url_generator service, which causes a conflict with the pwa module's expectations. A potential resolution could be to ensure that the cl_server module's FileUrlGenerator either extends the core FileUrlGenerator or that any service overrides are compatible with the core Drupal services.

Remaining tasks

  • Confirm the source of the service override.
  • Adjust the cl_server module's FileUrlGenerator service to be compatible with core expectations.

User interface changes

None

API changes

None

Data model changes

None

๐Ÿ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

๐Ÿ‡ฐ๐Ÿ‡ฌKyrgyzstan dan_metille

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

Merge Requests

Comments & Activities

  • Issue created by @dan_metille
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States akalata

    I am also getting a similar error if I have the TailwindCSS Utility module enabled.

    TypeError: Drupal\cl_server\Util::isRenderController(): Argument #1 ($request) must be of type Symfony\Component\HttpFoundation\Request, null given, called in /var/www/html/web/modules/contrib/cl_server/src/FileUrlGenerator.php on line 50 in Drupal\cl_server\Util::isRenderController() (line 22 of modules/contrib/cl_server/src/Util.php).

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia abhishek_virasat

    abhishek_gupta1 โ†’ made their first commit to this issueโ€™s fork.

  • Merge request !28fix the issue โ†’ (Open) created by abhishek_virasat
  • Status changed to Needs review 11 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia abhishek_virasat

    @akalata, I have fixed the issue and created patch . please kindly review the Patch file.

  • Pipeline finished with Success
    11 months ago
    #80719
Production build 0.71.5 2024