I’m trying to add Sentry to a Symfony application, but I can’t get the Sentry client to actually send anything to Sentry. I’ve followed the instructions by running composer require sentry/sentry-symfony, adding the DSN to my .env file, adding this controller;
<?php
namespace AppController;
use Exception;
use SymfonyComponentRoutingAnnotationRoute;
class SentryTestController
{
#[Route(path: 'sentry_test')]
public function test()
{
throw new Exception('test');
}
}
and going to the sentry_test page. While the exception is thrown, nothing appears in Sentry.
The Sentry bundle has been added to bundles.php as SentrySentryBundleSentryBundle::class => ['all' => true], I’ve tried setting APP_ENV=prod and APP_DEBUG=false, but it still doesn’t work.
Running php bin/console sentry:test (which got added as a command after installing sentry/sentry-symfony) results in
DSN correctly configured in the current client
Sending test message...
Message not sent!
<warning>Check your DSN or your before_send callback if used</warning>
Anything obvious I’m missing?