Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentry and Symfony error handlers conflicts #609

Closed
alexander-schranz opened this issue Mar 31, 2022 · 2 comments
Closed

Sentry and Symfony error handlers conflicts #609

alexander-schranz opened this issue Mar 31, 2022 · 2 comments

Comments

@alexander-schranz
Copy link
Contributor

alexander-schranz commented Mar 31, 2022

Environment

How do you use Sentry?
self-hosted/on-premise

sentry/sdk                                 3.1.1 
sentry/sentry                              3.4.0      
sentry/sentry-symfony                      4.2.7 

Steps to Reproduce

Have a symfony project with deprecations:

Run console command which triggers deprecation e.g.:

bin/console cache:clear

Output is normally:

Bildschirmfoto 2022-03-31 um 12 33 41

Install sentry / sentry bundle run again:

bin/console cache:clear

Bildschirmfoto 2022-03-31 um 12 33 22

It looks for me there is some conflicts between symfony error handler (think it handles also deprecations) and the sentry error handler.

In our case we already had disabled the error_listener but it does not have any effects depending on sentry symfony monolog integration:

config/packages/sentry.yaml
sentry:
    dsn: "%env(SENTRY_DSN)%"
    register_error_listener: false # Disable ErrorListener to avoid duplicated events because of monolog handler
    options:
        attach_stacktrace: true # Attach stacktrace to monolog events that do not include an exception
        send_default_pii: true # Include personally identifiable information like user, cookies and headers
        integrations:
            - 'Sentry\Integration\IgnoreErrorsIntegration'

# monolog configuration for sentry
# see also: https://docs.sentry.io/platforms/php/guides/symfony/
monolog:
    handlers:
        sentry:
            type: sentry
            level: !php/const Monolog\Logger::ERROR
            hub_id: Sentry\State\HubInterface

services:
    Monolog\Processor\PsrLogMessageProcessor:
        tags: { name: monolog.processor, handler: sentry }

    Sentry\Integration\IgnoreErrorsIntegration:
        arguments:
            $options:
                ignore_exceptions:
                    - 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException'

This issue is maybe related to: #337 and maybe a register_error_handler: false suggested by @Jean85 could fix this issue. But I'm not sure 100% sure it seems to appear only since symfony 5.4/6.0 release and the other issue seems to be older.

Expected Result

Do not output the deprecation notices.

Actual Result

Outputs the deprecation notices.

@Jean85
Copy link
Contributor

Jean85 commented Mar 31, 2022

Yes, our error handler and Symfony's interact weirdly, it would be better if we could proceed with #337

@github-actions
Copy link

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants