getsentry / sentry-symfony

The official Symfony SDK for Sentry (sentry.io)
https://sentry.io
MIT License
695 stars 171 forks source link

Compatibility Issue with Sentry Integration: Declaration Error in Http\Message\Encoding\FilteredStream #831

Closed JuicyLung91 closed 7 months ago

JuicyLung91 commented 7 months ago

How do you use Sentry?

Sentry SaaS (sentry.io)

SDK version

4.14.0

Steps to reproduce

Run composer require sentry/sentry-symfony in a shopware 6.4.20.2 Project. Run bin/console sentry:test

This is my config:

sentry:
    dsn: "https://MY-DSN"
    tracing:
        enabled: true
        dbal:
            enabled: false
        cache:
            enabled: false
        twig:
            enabled: false
        http_client:
            enabled: true
    messenger:
        enabled: true
    options:
        environment: '%kernel.environment%'
        release: '%env(SENTRY_RELEASE)%'
        # Trace 10% of requests
        traces_sample_rate: 0.1

Expected result

Send issues to sentry.

Actual result

I'm encountering a compatibility issue when trying to integrate Sentry into my Shopware 6 project. Shopware is based on symfony. Whenever I attempt to execute commands like ´bin/console sentry:test ´ or access the page, I'm encountering the following error:

Compile Error: Declaration of Http\Message\Encoding\FilteredStream::seek(int $offset, int $whence = Http\Message\Encoding\SEEK_SET): void must be compatible with Psr\Http\Message\StreamInterface::seek($offset, $whence = Psr\Http\Message\SEEK_SET)

My environment Symfony Framework version: v5.4.30 Monolog version: symfony/monolog-bundle: v3.6.0 Shopware Project Version: 6.4.20.2

Jean85 commented 7 months ago

It seems you're having a mismatch between your PSR-7 library and the php-http/message. The environment in which you generated your composer.lock may have some issues. Are you maybe using the ext-psr? This seems the same issue as in https://github.com/getsentry/sentry-php/issues/1718

JuicyLung91 commented 7 months ago

Hi @Jean85

Thanks for your prompt attention to my issue.

Indeed, the connection to Sentry was working flawlessly until recently when this error started occurring. I haven't made any changes to our composer.lock file, nor have I installed the ext-psr extension. It's puzzling that this issue arose seemingly out of nowhere, mirroring the situation described in the linked issue.

Upon debugging the code, I've noticed that Sentry is receiving a 429 "Too Many Requests" response. Could this be related to the current problem we're facing? When I look in our sentry dashboard the monthly limit is not reached but many issues are "dropped". I have only been considering the error limit so far. Is there also a rate limit I need to be aware of?

When I update the composer dependecies the error is gone but no issue is accapted by sentry anymore.

Jean85 commented 7 months ago

@cleptric any suggestion? 429 response may be caused by the flood protection?

When I update the composer dependecies the error is gone but no issue is accapted by sentry anymore.

WDYM? Are events sent out? What HTTP response do you get?

JuicyLung91 commented 7 months ago

I see this on sentry. The issues are "dropped". Dont know what this means. Should I change my plan?

Bildschirm­foto 2024-04-10 um 09 49 08

WDYM? Are events sent out? What HTTP response do you get?

429 or 200.

Jean85 commented 7 months ago

This is what the docs report: https://docs.sentry.io/product/stats/#usage-stats

Dropped events and attachments are ones the system dropped or discarded due to rate limits, quotas, spike protection, or because of invalid data.

I'll refer to someone inside Sentry to help you out further.

cleptric commented 7 months ago

If you tell me your org slug, I might be able to investigate why we drop these events.

JuicyLung91 commented 7 months ago

@cleptric Its liebscher-bracht

cleptric commented 7 months ago

Ohh, you ran out of quota 😬. So we won't accept any new events until Apr 20, 2024. It should show you this in a big banner on the top of each page.

cleptric commented 7 months ago

About the issue at hand, please upgrade to the new version 5.0 of this SDK. We completly rewrote the transport layer, shipping our own HTTP client, so you won't run into this issues anymore.

cleptric commented 7 months ago

And lastly, we have to improve customer insights, refs https://github.com/getsentry/sentry/issues/59320.

JuicyLung91 commented 7 months ago

Okay, thank you. Upon seeing the big banner, I interpreted it as indicating that the limit was nearing exhaustion rather than having already been reached. It says:

You are about to exceed your error limit and we will drop any excess events.

Thank you for now. I don't think I can update to 5.0 in my environment, but maybe I can just keep my other dependencies up to date :D

Feel free to close the issue.