sentry-symfony: Issue with custom error template rendering with 500 error

Environment

How do you use Sentry? Sentry SaaS (sentry.io)

Steps to Reproduce

  1. Migrate from “sentry/sentry-symfony:4.0” to “sentry/sentry-symfony:4.1”
  2. Env is prod (and debug is false)
  3. Monolog enabled
  4. Generate a 500 error

Expected Result

This should display my custom error page (templates/bundles/TwigBundle/Exception/error.html.twig)

Actual Result

The displayed error is the generic one : Capture d’écran 2021-04-20 à 12 47 24

It seems that TwigErrorRenderer is not called anymore.

404 errors are not concerned, the custom error page (templates/bundles/TwigBundle/Exception/error404.html.twig) is correctly displayed (as it was before on “sentry/sentry-symfony:4.0”).

Here is my configuration :

prod/sentry.yml

sentry:
    dsn: "%sentry.dsn%"
    options:
        environment: "%kernel.environment%"
        send_default_pii: true

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16

Most upvoted comments

I was able to run the reproducer and I indeed can see the issue, although the funny thing is that it appears after reloading the page a second time: with a cache still to be created the error page renders fine 🤔 The good news is that, as you pointed out, the issue seems to be with the DBAL, even though I don’t know why, and this is already a starting point. I’m investigating the problem and I will write back once I find the root cause

It works when I comment in TracingDriverConnection->traceFunction() (see https://github.com/getsentry/sentry-symfony/blob/master/src/Tracing/Doctrine/DBAL/TracingDriverConnection.php#L212) :

// return $callback();

I will provide a reproducer tomorrow.