Home > OS >  Symfony cache:clear problem: No session available
Symfony cache:clear problem: No session available

Time:05-14

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.

CodePudding user response:

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

  • Related