Problem/Motivation

Error : Call to undefined method Symfony\Component\HttpFoundation\RequestStack::getMainRequest() dans Drupal\big_pipe_sessionless\Render\BigPipeSessionless->primePageCache() (/home/bas/app_e16ddd73-9120-493c-adf8-9b02a8e7981e/modules/contrib/big_pipe_sessionless/src/Render/BigPipeSessionless.php ligne 118)

It seems it's a regression on 2.1, 2.0 has the right method `getMasterRequest()`

Proposed resolution

replace the code line 118 in BigPipeSessionless.php

<?php
$fake_request = $this->requestStack->getMasterRequest()->duplicate();
?>
CommentFileSizeAuthor
#14 primaPageCache.png473.12 KBzcht
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:

Comments

Grezag created an issue. See original summary.

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

ranjit1032002’s picture

Status: Active » Needs review

Created MR!2 for the issue mentioned, please review.
Thank You.

keshavv’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed the code and tested the MR. It looks good, Moving to RTBC.

wim leers’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

What are the steps to reproduce here?

Because https://www.drupal.org/project/big_pipe_sessionless/releases/2.1.0 is passing tests on 9.4, 9.5, 10.0 and 10.1: https://www.drupal.org/node/2866448/qa

zcht’s picture

Version: 2.1.0 » 2.x-dev
Status: Postponed (maintainer needs more info) » Active

Unfortunately I have the same problem, described here #3390297: Undefined method RequestStack::getMasterRequest(), the patch from this issue does not help.

Presumably the problem has to do with this CR [#3212750], so a query should be implemented in the module itself as to which Drupal version is currently running. Or alternatively, a new release only for Drupal 10.

wim leers’s picture

Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)
Related issues: +#3396005: Adopt GitLab CI

@Grezag, @Ranjit1032002, @keshavv and @zcht Can you each please let me know which exact version of Drupal core you are using?

Like I wrote in #6: tests are passing on 9.5, 10.0, 10.1 and even 10.2, since #3396005: Adopt GitLab CI.

zcht’s picture

I wrote in my first issue: Drupal 10.1.5, PHP 8.1.24, nginx 1.24
yes, i also saw that the tests ran successfully. unfortunately, the error does occur on the productive environment.

wim leers’s picture

I don't yet understand how it could possibly happen that it passes in tests, cannot be reproduced locally on a fresh install, but is happening on your production install.

The only plausible explanation I can think of right now: somehow, a different version of Symfony is being installed which does not support ::getMainRequest(). Could you please check your composer.lock and composer.json files?

zcht’s picture

Thanks for your feedback, unfortunately I don't understand that either. Thanks for the tip for the symfony version, the composer.lock has the following stored in it:

"symfony/console":"^6.3",
"symfony/dependency-injection":"^6.3",
"symfony/event-dispatcher":"^6.3",
"symfony/http-foundation":"^6.3",
"symfony/http-kernel":"^6.3",
"symfony/mime":"^6.3",
"symfony/polyfill-iconv":"^1.26",
"symfony/process":"^6.3",
"symfony/psr-http-message-bridge":"^2.1",
"symfony/routing":"^6.3",
"symfony/serializer":"^6.3",
"symfony/validator":"^6.3",
"symfony/yaml":"^6.3",

When checked on the server itself, all the necessary libraries are included. It can't be Symfony per se, otherwise I wouldn't be able to install Drupal 10.1.x and use various modules and services. It must be something else, but unfortunately I can't explain it at the moment either.

Just tested again, after I have executed a complete new build via Gitlab CI on the productive environment, I have explicitly set the Sessionless BigPipe module to version 2.2.0. Unfortunately, the same error remains, dblog log contains the errors listed above, the website becomes extremely slow... as soon as the module is deactivated, everything is normal and fast again.

zcht’s picture

Status: Postponed (maintainer needs more info) » Needs work

Yesterday I updated the entire productive stack, including Drupal to version 10.2.1. I tried again to activate the sessionless BigPipe, as soon as this happens, pretty much all calls on the productive environment break.

Unfortunately, the error remains, and I cannot reproduce the error locally either.

A spontaneous idea, I still have the Quicklink module in use, could it be that both modules are interfering with each other? Both modules used to run without problems, but a lot has changed with Drupal and the modules. Perhaps the combination of the two does not fit here. At least that's my only assumption at the moment.

Full error stack:

Error: Call to undefined method Symfony\Component\HttpFoundation\RequestStack::getMasterRequest() in Drupal\big_pipe_sessionless\Render\BigPipeSessionless->primePageCache() (Zeile 138 in /var/www/vhosts/docroot/modules/contrib/big_pipe_sessionless/src/Render/BigPipeSessionless.php)
#0 /var/www/vhosts/docroot/modules/contrib/big_pipe_sessionless/src/Render/BigPipeSessionless.php(85): Drupal\big_pipe_sessionless\Render\BigPipeSessionless->primePageCache()
#1 /var/www/vhosts/docroot/core/modules/big_pipe/src/Render/BigPipeResponse.php(112): Drupal\big_pipe_sessionless\Render\BigPipeSessionless->sendContent()
#2 /var/www/vhosts/vendor/symfony/http-foundation/Response.php(425): Drupal\big_pipe\Render\BigPipeResponse->sendContent()
#3 /var/www/vhosts/docroot/index.php(20): Symfony\Component\HttpFoundation\Response->send()
#4 {main}
wim leers’s picture

Status: Needs work » Postponed (maintainer needs more info)
Issue tags: +Needs steps to reproduce

How is this possible considering the tests pass just fine? (https://git.drupalcode.org/project/big_pipe_sessionless/-/pipelines/73955)

Also, how is

Error: Call to undefined method Symfony\Component\HttpFoundation\RequestStack::getMasterRequest() in Drupal\big_pipe_sessionless\Render\BigPipeSessionless->primePageCache() (Zeile 138 in /var/www/vhosts/docroot/modules/contrib/big_pipe_sessionless/src/Render/BigPipeSessionless.php)

possible given that the code on line 138 is this:

$fake_request = $this->requestStack->getMainRequest()->duplicate();

👆MAIN, not MASTER 🤯

What version of big_pipe_sessionless are you on? 🤔

zcht’s picture

StatusFileSize
new473.12 KB

I have the current stable version: 2.2.0. The line 138 on the productive environment looks like this, see screenshot. But I also see that it is correct in the source code of the module: https://git.drupalcode.org/project/big_pipe_sessionless/-/blob/2.x/src/R...

I'm trying to completely uninstall the module, remove it, with between deployments and reinstall it so that the correct code is used. However, I really can't explain why this is the case :(

zcht’s picture

@Wim Leers Thanks again for your support. It was a very wild ride for me, but everything is finally working as it should. Unfortunately I can't explain why it was such a problem with this module in particular. What I did: deactivated and uninstalled the module, deployed to prod, downgraded the module, deployed to prod, deactivated and uninstalled the module, deployed to prod, installed the current version, deployed to prod... everything was fine. really, i have absolutely no idea why this was such a struggle.

but you are absolutely right, tests are successful, current version runs as it should and i now have the current code version on the productive environment with MAIN, instead of MASTER.

Thanks again and sorry for the struggle :)

wim leers’s picture

Category: Bug report » Support request
Status: Postponed (maintainer needs more info) » Fixed
Issue tags: -Needs steps to reproduce

Marking as fixed per #15. I think you hit a weird "wrong Symfony or BigPipe Sessionless version installed" problem, see #3428235-11: New major release for Drupal 11 compatibility.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.