-2

The problem is very simple. The applications works as expected, no problems, sessions work, etc. But when I try to clear the cache:

bin/console c:c
// Clearing the cache for the dev environment with debug true                                                          

In RequestStack.php line 105:
                                            
  There is currently no session available.  

Any ideas?

Symfony version 6, all the latest packages.

  • I guess I don't really understand how clearing the cache is dependent on a session being available or where to start to look for the problem. – Edgars Vilums May 03 '22 at 09:30
  • 1
    try `bin/console c:c -vvv` and you will get more information – craigh May 03 '22 at 11:31
  • Have you create a subscriber a with KernelEvents::REQUEST ? it passes at the same time as Session was creating. change your event priorities – Shoooryuken May 12 '22 at 09:17

1 Answers1

0

The issue was in one of the Services, trying to call

requestStack->getSession() 

in the __construct method.

The key to finding this error was to get a stack trace, using the bin/console c:c -vvv