Symfony cache:clear problem: No session available

980 Views Asked by At

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.

1

There are 1 best solutions below

0
Edgars Vilums On BEST ANSWER

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