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 App\Controller;
use Exception;
use Symfony\Component\Routing\Annotation\Route;
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 Sentry\SentryBundle\SentryBundle::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?
After diving into the source code for both sentry/sentry
and sentry/sentry-symfony
, I came across a cURL HTTP error. After googling that specific error the fix was quite simple; composer update "sentry/*" -W
to update all Sentry packages and their dependencies. I figured running composer require sentry/...
would install the latest available version, but apparently it did not.
Sentry works properly now.