Closed
Description
Symfony version(s) affected
7.0.2, 6.4.2
Description
When trying to clear cache pools using the cache:pool:clear --all
command while in a production environment (i.e. APP_ENV=prod
), the command fails with the following error on Symfony 6.4:
In Container.php line 249:
The "cache.annotations" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection
instead.
cache:pool:clear [--all] [--exclude EXCLUDE] [--] [<pools>...]
Failed to execute command bin/console cache:pool:clear --all: exit status 1
And on Symfony 7.0:
In Container.php line 240:
The "cache.asset_mapper" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection
instead.
cache:pool:clear [--all] [--exclude EXCLUDE] [--] [<pools>...]
Failed to execute command bin/console cache:pool:clear --all: exit status 1
Both of these happen only in the prod env, the dev env works perfectly fine.
How to reproduce
- Create a new webapp installation of the app from
symfony/skeleton
. - Change
APP_ENV
toprod
. - Attempt to run the
cache:pool:clear --all
command.
Possible Solution
No response
Additional Context
No response