You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to set an event subscriber to add context like this:
<?php
namespace AppBundle\Sentry;
use Sentry\SentryBundle\Event\SentryUserContextEvent;
use Sentry\SentryBundle\SentrySymfonyEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class AddCommunityContextSubscriber implements EventSubscriberInterface
{
/**
* @var \Raven_Client
*/
protected $client;
public function __construct(\Raven_Client $client)
{
$this->client = $client;
}
public static function getSubscribedEvents()
{
return array(
SentrySymfonyEvents::SET_USER_CONTEXT => 'onSetUserContext'
);
}
public function onSetUserContext(SentryUserContextEvent $event)
{
...
$this->client->user_context([
...
]);
}
}
But I'm facing an issue The service "AppBundle\Sentry\AddCommunityContextSubscriber" has a dependency on a non-existent service "sentry.client"
I tried several configurations but none worked.
The problem may arise from the fact that the client is present only when the bundle is present. If you have included the bundle only in the prod environment, that's where you're having the issue.
You either have to enable the bundle in dev too (but maybe disable the DSN) or include your listener only in the same envs.
Hi,
I would like to set an event subscriber to add context like this:
But I'm facing an issue
The service "AppBundle\Sentry\AddCommunityContextSubscriber" has a dependency on a non-existent service "sentry.client"
I tried several configurations but none worked.
I checked #158 but without sucesss too.
My symfony version is 3.4 and I am using the latest version of this bundle (2.2.0).
The text was updated successfully, but these errors were encountered: