activation of event subscriber make container compilation fail
Closed this issue · 3 comments
Hello,
I've activated event subscribers by using this configuration
services:
_defaults:
autowire: true
autoconfigure: true
public: false
_instanceof:
AppBundle\EventListener\DomainEventSubscriberInterface:
tags:
- { name: tactician.event_subscriber }
While it worked in dev environment, I got this issue while running a cache:clear command in production
docker-compose run --rm php php bin/console cache:clear --env=prod -vvv !10320
In ParameterBag.php line 102:
[Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
You have requested a non-existent parameter "container.build_id".
Exception trace:
Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->get() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php:57
Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag->get() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:133
Symfony\Component\DependencyInjection\Container->getParameter() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1268
Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1221
Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1134
Symfony\Component\DependencyInjection\ContainerBuilder->createService() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:623
Symfony\Component\DependencyInjection\ContainerBuilder->doGet() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1264
Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1221
Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1134
Symfony\Component\DependencyInjection\ContainerBuilder->createService() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:623
Symfony\Component\DependencyInjection\ContainerBuilder->doGet() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1264
Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1221
Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1134
Symfony\Component\DependencyInjection\ContainerBuilder->createService() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:623
Symfony\Component\DependencyInjection\ContainerBuilder->doGet() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1264
Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1221
Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1134
Symfony\Component\DependencyInjection\ContainerBuilder->createService() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:623
Symfony\Component\DependencyInjection\ContainerBuilder->doGet() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1264
Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1221
Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1221
Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1134
Symfony\Component\DependencyInjection\ContainerBuilder->createService() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:623
Symfony\Component\DependencyInjection\ContainerBuilder->doGet() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1264
Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1221
Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1134
Symfony\Component\DependencyInjection\ContainerBuilder->createService() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:623
Symfony\Component\DependencyInjection\ContainerBuilder->doGet() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:588
Symfony\Component\DependencyInjection\ContainerBuilder->get() at /var/www/vendor/bornfreee/tactician-domain-events-bundle/src/DependencyInjection/Compiler/PopulateDebugCommandPass.php:33
BornFree\TacticianDomainEventBundle\DependencyInjection\Compiler\PopulateDebugCommandPass->process() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:141
Symfony\Component\DependencyInjection\Compiler\Compiler->compile() at /var/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:778
Symfony\Component\DependencyInjection\ContainerBuilder->compile() at /var/www/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:643
Symfony\Component\HttpKernel\Kernel->initializeContainer() at /var/www/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:137
Symfony\Component\HttpKernel\Kernel->boot() at /var/www/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:64
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:148
Commenting out the tagging feature from the services.yml file avoided this error.
I could get rid of this error by removing the $serializer
argument from this subscriber constructor
final class VotingBallotCreationSubscriber implements DomainEventSubscriberInterface
{
private $producer;
private $serializer;
public function __construct(
Serializer $serializer,
Producer $producer
) {
$this->serializer = $serializer;
$this->producer = $producer;
}
Any idea about how to solve that or how I can give more debug information if needed ?
Regards,
Mikael
I stumbled on this comment which leaves me wondering to which extent this applies to the PopulateDebugCommandPass...
If I disable this compiler pass, the error disappears
Same problem here.
The issue happens because of getting event subscribers services in compiler pass. This should not be done like that - I suggest moving that logic to the command itself.
@kermorgant Apologize, I don't know how I missed your issue, just saw it when @thatside bumped it.
The fix has been merged and released under 0.5.4
.
Thank you