Type error when using the CDN module

Created on 28 February 2024, 4 months ago

Problem/Motivation

Type mismatch on concrete implementation. We are using the CDN module which replaces the file_url_generator service with their own implementation. When trying to select the plugin for a field provided by the md_viewer, it generates the following error:

The website encountered an unexpected error. Try again later.

TypeError: Drupal\md_viewer\Plugin\Field\FieldFormatter\MDocViewerFieldFormatter::__construct(): Argument #9 ($file_url_generator) must be of type Drupal\Core\File\FileUrlGenerator, Drupal\cdn\File\FileUrlGenerator given, called in /opt/drupal/web/modules/contrib/md_viewer/src/Plugin/Field/FieldFormatter/MDocViewerFieldFormatter.php on line 94 in Drupal\md_viewer\Plugin\Field\FieldFormatter\MDocViewerFieldFormatter->__construct() (line 61 of modules/contrib/md_viewer/src/Plugin/Field/FieldFormatter/MDocViewerFieldFormatter.php).
Drupal\md_viewer\Plugin\Field\FieldFormatter\MDocViewerFieldFormatter::create(Object, Array, 'mdocviewer_field', Array) (Line: 64)
Drupal\Core\Field\FormatterPluginManager->createInstance('mdocviewer_field', Array) (Line: 126)
Drupal\Core\Field\FormatterPluginManager->getInstance(Array) (Line: 205)
Drupal\Core\Entity\Entity\EntityViewDisplay->getRenderer('field_budget') (Line: 370)
Drupal\field_ui\Form\EntityDisplayFormBase->buildFieldRow(Object, Array, Object) (Line: 41)
Drupal\field_ui\Form\EntityViewDisplayEditForm->buildFieldRow(Object, Array, Object) (Line: 227)
Drupal\layout_builder\Form\LayoutBuilderEntityViewDisplayForm->buildFieldRow(Object, Array, Object) (Line: 213)
Drupal\field_ui\Form\EntityDisplayFormBase->form(Array, Object) (Line: 47)
Drupal\layout_builder\Form\LayoutBuilderEntityViewDisplayForm->form(Array, Object) (Line: 107)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object) (Line: 40)
Drupal\layout_builder\Form\LayoutBuilderEntityViewDisplayForm->buildForm(Array, Object, Object)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('entity_view_display_edit_form', Object) (Line: 283)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 44)
Drupal\redirect_after_login\RedirectMiddleware->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 53)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

Install and configure the CDN module for all files

Proposed resolution

Use the interface definition instead of the concrete implementation.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

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

Comments & Activities

Production build 0.69.0 2024