litespeedtech/lscache-drupal

Drupal 8.6.x issue: TypeError: Argument 2 passed to Drupal\page_cache\StackMiddleware\PageCache::storeResponse()

Closed this issue · 5 comments

I get the following error for image generating (and other files too) since upgrading to Drupal 8.6.x (Currently on 8.6.7):

TypeError: Argument 2 passed to Drupal\page_cache\StackMiddleware\PageCache::storeResponse() must be an instance of Symfony\Component\HttpFoundation\Response, null given, called in /home/saschaeg/public_html/saschaeggenberger.com/core/modules/page_cache/src/StackMiddleware/PageCache.php on line 188 in Drupal\page_cache\StackMiddleware\PageCache->storeResponse() (line 205 of /home/saschaeg/public_html/saschaeggenberger.com/core/modules/page_cache/src/StackMiddleware/PageCache.php) #0 /home/saschaeg/public_html/saschaeggenberger.com/core/modules/page_cache/src/StackMiddleware/PageCache.php(188): Drupal\page_cache\StackMiddleware\PageCache->storeResponse(Object(Symfony\Component\HttpFoundation\Request), NULL) #1 /home/saschaeg/public_html/saschaeggenberger.com/core/modules/page_cache/src/StackMiddleware/PageCache.php(121): Drupal\page_cache\StackMiddleware\PageCache->fetch(Object(Symfony\Component\HttpFoundation\Request), 1, true) #2 /home/saschaeg/public_html/saschaeggenberger.com/core/modules/page_cache/src/StackMiddleware/PageCache.php(75): Drupal\page_cache\StackMiddleware\PageCache->lookup(Object(Symfony\Component\HttpFoundation\Request), 1, true) #3 /home/saschaeg/public_html/saschaeggenberger.com/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #4 /home/saschaeg/public_html/saschaeggenberger.com/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #5 /home/saschaeg/public_html/saschaeggenberger.com/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #6 /home/saschaeg/public_html/saschaeggenberger.com/core/lib/Drupal/Core/DrupalKernel.php(693): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #7 /home/saschaeg/public_html/saschaeggenberger.com/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #8 {main}.

These must be a change of passed arguments from 8.5.x to 8.6.x

It seems Drupal internal cache is in play, do you have LSCache module active as well? If so, does the error go away if you disable the LSCache plugin?

@usmannasir if I disable/uninstall the LSCache Module the issue is gone

Try this patch

I don't know why it's not returning a response when it's not cacheable.
@usmannasir it is a missing case ?

litespeedtech-lscache-drupal-10--return-response-when-no-cache.txt

The patch from @Bahlaouane-Hamza shouble be merged from our point of view. Our developers crafted a similar patch them selves to be able to get the module in production on a customer website. Not 100% sure if there any side effects though.