When there is an entity_browser and devel installed - no way to load browsers list when devel is enabled because of

Uncaught PHP Exception Symfony\\Component\\Routing\\Exception\\MissingMandatoryParametersException: "Some mandatory parameters are missing ("machine_name", "step") to generate a URL for route "entity.entity_browser.devel_load"." at /var/www/docroot/core/lib/Drupal/Core/Routing/UrlGenerator.php line 171, referer: http://drupal.192.168.56.132.xip.io/admin/config/content/embed/button/manage/block

Disabling devel helps

Issue fork devel-2726209

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

podarok created an issue. See original summary.

willzyx’s picture

@podarok thanks for reporting

can you indicate the steps to reproduce this issue on a clean installation?
I have played a little with entity_browser anf the test module entity_browser_test but I cannot reproduce the issue

Also, what version of devel you use?
Some time ago we had some problems with ctools wizards that produce the same exception (see #2643790: edit-form in ctools_wizard_test's ExampleConfigEntity incompatible with Devel) but the problems was solved in #2644152: Devel Load does not work for Ctools entity wizards.
Please can you install the latest dev version and see if the issue is still reproducible?

willzyx’s picture

Status: Active » Postponed (maintainer needs more info)
willzyx’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Closing for lack of activity. Feel free to reopen if the issue still exists

LOBsTerr’s picture

This issue appears if we have the canonical with two parameters for example like for group module GroupContent

*     "canonical" = "/group/{group}/content/{group_content}",

Steps to reproduce
1) Install group and devel
2) Create a group
3) Open URL: devel/group_content/1 (or any other Ids available in your db)

Symfony\Component\Routing\Exception\MissingMandatoryParametersException: Some mandatory parameters are missing ("group") to generate a URL for route "entity.group_content.token_devel". in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 182 of /home/ubuntu/environment/web/core/lib/Drupal/Core/Routing/UrlGenerator.php).

More information could be found here #3088833: WSOD with group module: Some mandatory parameters are missing ("group") to generate a URL for route "entity.group.devel_load".

LOBsTerr’s picture

1) This patch dynamically builds route with all parameters from the current entity routes
2) This patch dynamically adds all parameters from the current entity routes

This will build the URLs correctly and will not cause exception from the previous comment.

I have change the structure of URLs.
from devel/group_content/[ID]/definition to devel/definition/group_content/[id1]/[id2]
from devel/group_content/[ID]/render to devel/render/group_content/[id1]/[id2]

We can keep the old URLs, but I believe like this it looks better.

jonathan1055’s picture

Hi @LOBsTerr,
Are you actually using Devel 8.x-1.x? This issue was started 3 1/2 years ago when 1.x was the only D8 branch. Is this a 2.x or 3.x problem?

LOBsTerr’s picture

@jonathan1055, This issue exists in many places. Even the ticket is old it can still appear for any entity routes, which use more than one parameter in their route. Devel takes into account only the current entity parameter.
Another place, where it happens is webform, but they found kind of work around.

This is a route.

 Route                  entity.webform_submission.token_devel                                                 
 Path                   /admin/structure/webform/manage/{webform}/submission/{webform_submission}/devel/token 
 Defaults                                                                                                     
  _controller           \Drupal\token\Controller\TokenDevelController::entityTokens                           
  _title                Devel Tokens                                                                          
 Requirements                                                                                                 
  _permission           access devel information                                                              
  _module_dependencies  devel                                                                                 
 Options                                                                                                      
  compiler_class        Drupal\Core\Routing\RouteCompiler                                                     
  _admin_route          1                                                                                     
  _token_entity_type_id webform_submission                                                                    
  parameters            webform_submission:                                                                   
                          type: 'entity:webform_submission'                                                   
                          converter: paramconverter.entity

This is a workaround

  // ISSUE:
  // Devel routes do not use 'webform' parameter which throws the below error.
  // Some mandatory parameters are missing ("webform") to generate a URL for
  // route "entity.webform_submission.canonical"
  //
  // WORKAROUND:
  // Make sure webform parameter is set for all routes.
  if (strpos($route_name, 'entity.webform_submission.devel_') === 0 || $route_name === 'entity.webform_submission.token_devel') {
    foreach ($data['tabs'] as $tab_level) {
      foreach ($tab_level as $tab) {
        /** @var Drupal\Core\Url $url */
        $url = $tab['#link']['url'];
        $tab_route_name = $url->getRouteName();
        $tab_route_parameters = $url->getRouteParameters();

        if (strpos($tab_route_name, 'entity.webform_submission.devel_') !== 0) {
          $webform_submission = WebformSubmission::load($tab_route_parameters['webform_submission']);
          $url->setRouteParameter('webform', $webform_submission->getWebform()->id());
        }
      }
    }
  }

Also they've added some routes, which will not throw the exceptions.

My proposal is to take all available parameters in the route when we set a link for an entity and then add then to a route which we set for the link.
I am not sure if it is the best way to handle it, but it works.

jonathan1055’s picture

Version: 8.x-1.x-dev » 8.x-3.x-dev

OK, so I've changed the issue version. Note that testig on d.o. is currently broken for 8.8 so we have to test at 8.9

Javier_Rey’s picture

I have a custom entity, with paths like "/user/{user}/documents/{document}". When entering the devel tab of the "document" entity, the WSOD appeared.

This patch solves that issue, but when I try to reinstall my module, I get the error "Recursive router rebuild detected".

Core: 9.2.0
Devel: 4.1.1

interdruper’s picture

Status: Needs review » Needs work

Same problems that #10 with this patch: "Recursive router rebuild detected" when installing modules.

jonathan1055’s picture

Status: Needs work » Closed (outdated)

Hi @interdruper

The Devel module has now been migrated to https://gitlab.com/drupalspoons/devel within DrupalSpoons the home for Drupal modules on GitLab. All development, bug fixes and testing will be done over there.

This issue is now at https://gitlab.com/drupalspoons/devel/-/issues/256

z3cka made their first commit to this issue’s fork.

LOBsTerr’s picture

Status: Closed (outdated) » Needs review
FileSize
7.74 KB
6.37 KB

I will post the fix patch here, because it is a bit confusing, were I should create a mr.
Basically, I have changed an approach how do we get parameters. Unfortunately, we can't use RouteBuilder here, because it causes recursive calls. So, I parse the give edit-form route and get parameters from there and dynamically set it.

It solves WSOD and recursive calls.

jonathan1055’s picture

Status: Needs review » Closed (outdated)

Hi LOBsTerr
As I said in #12 all development is now on Drupalspoons. No patch will get tested here in the drupal issue queue, and no one will find this issue from the Devel project page because it has been disabled.

Please go to https://gitlab.com/drupalspoons/devel/-/issues/256 where you can comment on the issue and discuss fixes, etc.

Thanks

jonathan1055’s picture

Ah, I can see you have already posted on the drupalspoons issue. That's great, stay on that thread :-)

LOBsTerr’s picture

@jonathan1055, yes, sorry for that. It took me sometime to find the proper place. I also posted it here to give people to test it.

proweb.ua’s picture

#16 works

LOBsTerr’s picture

@proweb.ua - it was merged already https://gitlab.com/drupalspoons/devel/-/merge_requests/90
It is better to use this version, because it contains some improvements.