I may assume that something wasn't configured correctly in regard to server settings / Drupal cookies settings, https, so Drupal / Symphony just stripped those cokkies on your end, as no one else reported the issue & I couldn't reproduce it myself I closing it for now, feel free to reopen the task if it's considered as a bug for you.
I've provided co-maintainer access to https://www.drupal.org/u/welly →
added to 8.x-1.8 release
added to 8.x-1.8 release
Just to elaborate on post above how the oath service was got into cache deps for user registry form:
I have redirect subscriber that uses third party oauth logic in redirects flow:
myaccount.event_subscriber:
class: 'Drupal\myaccount\EventSubscriber\EventSubscriber'
arguments:
- '@current_user'
- '@?crm_api.client'
- '@entity_type.manager'
- '@cache.data'
- '@state'
- '@messenger'
- '@path.current'
tags:
- {name: event_subscriber}
I believe if you add a subscriber with request or url generator dep & page is cached, on cache get contrib logic will result in fatal
Just for debug purposes:
core 9.5.3, PHP 8.1
It seems the issue happens in different contexts. In my case I have standard themed Drupal registry form without popups, first time page opens fine after it gets caches in anon session every next request results in this error:
The website encountered an unexpected error. Please try again later.
TypeError: Drupal\Core\Routing\RequestContext::fromRequest(): Argument #1 ($request) must be of type Symfony\Component\HttpFoundation\Request, null given, called in /projects/matchtech/docroot/core/lib/Drupal/Core/Routing/RequestContext.php on line 28 in Drupal\Core\Routing\RequestContext->fromRequest() (line 34 of core/lib/Drupal/Core/Routing/RequestContext.php).
Drupal\Core\Routing\RequestContext->fromRequest() (Line: 28)
Drupal\Core\Routing\RequestContext->fromRequestStack()
call_user_func_array() (Line: 276)
Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
Drupal\Component\DependencyInjection\Container->get() (Line: 434)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() (Line: 273)
Drupal\Component\DependencyInjection\Container->createService() (Line: 449)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() (Line: 237)
Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
Drupal\Component\DependencyInjection\Container->get() (Line: 434)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() (Line: 237)
Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
Drupal\Component\DependencyInjection\Container->get() (Line: 434)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() (Line: 237)
Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
Drupal\Component\DependencyInjection\Container->get() (Line: 89)
Drupal\Core\Plugin\PluginBase->__wakeup()
unserialize() (Line: 167)
Drupal\Core\Cache\DatabaseBackend->prepareItem() (Line: 122)
Drupal\Core\Cache\DatabaseBackend->getMultiple() (Line: 92)
Drupal\Core\Cache\DatabaseBackend->get() (Line: 306)
Drupal\page_cache\StackMiddleware\PageCache->get() (Line: 124)
Drupal\page_cache\StackMiddleware\PageCache->lookup() (Line: 82)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
Stack\StackedHttpKernel->handle() (Line: 713)
Drupal\Core\DrupalKernel->handle() (Line: 19)
On sixth backtrace line `Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() (Line: 273)` it tries to get erroring request method by solving deps for `Drupal\Core\Routing\UrlGenerator`
In my case the base service in backtrace has this service - `oauth2ClientService`.
So just an assumption to conclude - if on the cached page with form you have a service that depends on the op service after cache get & wakeup it will lead to fatal
@rpayanm, I don't think so, atm it works, but if branch will be updated on gitlab side (added commit etc) it might break project composer & people working on it eg FE guys will be blocked for a while. We had it many times with gitlab based links, so it's just a snapshot of a piece of code that was verified & applied to our project internally, sorry for noise.
Pavel Ruban → created an issue. See original summary → .
convert MR's commit to static file patch for those who need.
Pavel Ruban → created an issue.