Batch data export triggers MissingMandatoryParametersException with contextual argument in URL

Created on 30 January 2023, over 1 year ago
Updated 21 May 2024, about 1 month ago

Problem/Motivation

If the related View gets contextual arguments from the URL, a batched bulk data export fails with a MissingMandatoryParametersException error. E.g.:

Symfony\Component\Routing\Exception\MissingMandatoryParametersException: Some mandatory parameters are missing ("node") to generate a URL for route "view.test.page_1". in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 181 of /var/lib/tugboat/stm/web/core/lib/Drupal/Core/Routing/UrlGenerator.php).

Steps to reproduce

Attached as a file views.view.test.yml is the config export for a test view with a page display /test/%node/titles and a data export display /test/%node/titles/export.csv which demonstrates the issue. The view lists "all" of the titles for nodes matching the node ID in the URL (which of course can only have one result, but this is just for example purposes -- my original view with many results behaved identically).

(n.b. This attachment was automatically renamed upon upload to this issue with the message: "For security reasons, your upload has been renamed to views.view_.test.yml.")

Import the contents of this config file at admin/config/development/configuration/single/import as configuration type "View".

If there are no nodes in the database, also add a new node.

Assuming node ID 1 is valid, visit test/1/titles to see the page view, and then click the CSV link to attempt the batched data export.

This will result in an error like the one quoted previously. Check admin/reports/dblog to see the details.

Notice that changing the View's "Export settings" to use the non-batched method prevents the problem (but obviously isn't a solution in cases where the result set may be very large), so the issue seems related to the batch feature.

I'll also point out that the route indicated in the error is the page route view.test.page_1, not the data export route. My attempts at debugging showed that the Drupal\Core\Routing\UrlGenerator code seemed happy with the path argument when the route for the data export display was being processed, but processing the page route during that request was triggering this exception.

πŸ› Bug report
Status

Closed: duplicate

Version

1.2

Component

Code

Created by

πŸ‡³πŸ‡ΏNew Zealand jweowu

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

Comments & Activities

Production build 0.69.0 2024