InvalidParameterException: Parameter "queueName" for route "queue_ui.inspect" must match "[^/]++" ("queue_unique/mymodule_entity_update" given) to generate a corresponding URL

Created on 6 March 2024, 4 months ago

Problem/Motivation

Integration issue with contrib module Queue UI β†’ .

Fatal error resulting in WSOD with the following error :

Symfony\Component\Routing\Exception\InvalidParameterException: Parameter "queueName" for route "queue_ui.inspect" must match "[^/]++" ("queue_unique/mymodule_entity_update" given) to generate a corresponding URL. in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 209 of core/lib/Drupal/Core/Routing/UrlGenerator.php).

Complete error message :

The website encountered an unexpected error. Try again later.

Symfony\Component\Routing\Exception\InvalidParameterException: Parameter "queueName" for route "queue_ui.inspect" must match "[^/]++" ("queue_unique/mymodule_entity_update" given) to generate a corresponding URL. in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 209 of core/lib/Drupal/Core/Routing/UrlGenerator.php).
Drupal\Core\Routing\UrlGenerator->getInternalPathFromRoute('queue_ui.inspect', Object, Array, Array) (Line: 300)
Drupal\Core\Routing\UrlGenerator->generateFromRoute('queue_ui.inspect', Array, Array, 1) (Line: 108)
Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute('queue_ui.inspect', Array, Array, 1) (Line: 765)
Drupal\Core\Url->toString(1) (Line: 183)
Drupal\Core\Utility\LinkGenerator->generate(Object, Object) (Line: 102)
Drupal\Core\Render\Element\Link::preRenderLink(Array)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 858)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 421)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 240)
Drupal\Core\Render\Renderer->render(Array) (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 77)
__TwigTemplate_ff0a79478f30d6f9ce95b86c213bc18d->doDisplay(Array, Array) (Line: 394)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 367)
Twig\Template->display(Array) (Line: 379)
Twig\Template->render(Array) (Line: 38)
Twig\TemplateWrapper->render(Array) (Line: 39)
twig_render_template('core/modules/system/templates/links.html.twig', Array) (Line: 348)
Drupal\Core\Theme\ThemeManager->render('links__dropbutton', Array) (Line: 480)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 240)
Drupal\Core\Render\Renderer->render(Array) (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 179)
__TwigTemplate_17b5762dc87267394313f49444c0a264->doDisplay(Array, Array) (Line: 394)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 367)
Twig\Template->display(Array) (Line: 379)
Twig\Template->render(Array) (Line: 38)
Twig\TemplateWrapper->render(Array) (Line: 39)
twig_render_template('core/themes/claro/templates/classy/dataset/table.html.twig', Array) (Line: 348)
Drupal\Core\Theme\ThemeManager->render('table', Array) (Line: 480)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 493)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 240)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 238)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 239)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 128)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 186)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->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: 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

Enable module Queue UI β†’ with a module with a queue prefixed with queue_unique/, then browse to : /admin/config/system/queue-ui.

See screenshot below :

Apparently this relates to:
https://git.drupalcode.org/project/queue_ui/-/blob/3.1.x/queue_ui.routin...
path: admin/config/system/queue-ui/inspect/{queueName}
where {queueName} evaluates with a '/' character, for example: 'queue_unique/mymodule_entity_update'.

Queue Unique currently recommends prefixing a queue with 'queue_unique/', see :
https://git.drupalcode.org/project/queue_unique/-/blob/3.x/README.md?ref...
In particular in the example provided for the creation of a custom queue declared to use Queue Unique as backend :

/**
 * Queue worker to handle when something has changed.
 *
 * @QueueWorker(
 *   id = "queue_unique/mymodule_entity_update",
 *   title = @Translation("Handle entity create or update."),
 *   cron = {"time" = 20}
 * )
 */

Although there doesn't seem to be currently any recommendation on the naming convention of plugin ID and more particularly a queue, see : πŸ“Œ Document valid plugin ID format Active , it would appear that using the special character '/' as a separator in the queue name could clearly cause issues with other modules, or potentially core.

The problem could probably also be approached on the Queue UI β†’ side, but it would maybe require further investigation and probably involve more changes.

I'm not sure exactly what could be the best approach to fix this issue, that's why I would greatly appreciate your feedback on what could be the best solution to fix to this problem.

Proposed resolution

For the time being, could we settle for an easy fix?

We would like to recommend avoiding the use of the slash character '/' as a separator in the plugin ID and perhaps use something more consensual, less "risky" or prone to errors, such as a double underscore '__'.

In order to prevent breaking the existing logic and modules potentially implemented with 'queue_unique/', we would recommend adding the possibility of prefixing with 'queue_unique__', in which case the following examples would both work :
queue_unique/mymodule_entity_update
and
queue_unique__mymodule_entity_update
 

Better yet, ideally, we would like to request potentially moving this prefix to a suffix so that the queue could potentially still start with the custom name defined in the module, for example, in which case we could have :
mymodule_entity_update__queue_unique

Remaining tasks

Files and sections of code that would be impacted :

 

We would greatly appreciate if you could please take a look at this issue, in particular give us your feedback on the suggested solution, of adding a different syntax to identify a queue as unique based on its ID.

Feel free to let us know if you have any questions, comments or concerns on any aspects of this ticket or the project in general, we would surely be glad to provide more information.
Thanks in advance !

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡«πŸ‡·France DYdave

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

Comments & Activities

Production build 0.69.0 2024