medienreaktor / sentry
Integrates sentry compatible error tracking into Neos.
Package info
github.com/medienreaktor/Medienreaktor.Sentry
Type:neos-package
pkg:composer/medienreaktor/sentry
Requires
- guzzlehttp/guzzle: ^7.0
- neos/flow: ^8.0 || ^9.0
- punktde/sentry-neos: ^4.4
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Non-blocking asynchronous Sentry transport for Neos Flow applications.
Overview
This package extends PunktDe.Sentry.Neos with a asynchronous transport layer that prevents Sentry logging from impacting application response times. By using Guzzle's async capabilities in a fire-and-forget manner, error reporting happens in the background without blocking the main request.
Why this package?
When logging multiple errors to Sentry in a single request, the default synchronous transport can significantly slow down your application. Each event waits for a response from the Sentry server before continuing. This package solves that problem by:
- Non-blocking requests: Events are sent asynchronously without waiting for server responses
- Fire-and-forget: Your application continues immediately after triggering the send
- Maintained compatibility: Preserves all Sentry features including rate limiting and error handling
Requirements
- Neos Flow 8.x - 9.x
- PunktDe.Sentry.Neos ^4.0
- Guzzle HTTP client (typically already available in Flow/Neos)
Installation
composer require medienreaktor/sentry
Configuration
Just configure the environment variables for the package. The SENTRY_DSN is needed. That's it! All other PunktDe.Sentry.Flow settings work as usual.
How it works
The GuzzleAsyncTransport implements Sentry's TransportInterface and:
- Serializes events using Sentry's standard payload serializer
- Sends HTTP requests via Guzzle's
postAsync()method - Triggers the request with
wait(false)to ensure it's sent without blocking - Handles responses and errors asynchronously in background callbacks
Technical Details
- Uses lazy initialization to retrieve Sentry options from the SDK
- Preserves all standard Sentry features (rate limiting, profiling, etc.)
- Logs successes and failures for debugging purposes
- Gracefully handles errors in fire-and-forget mode
Flow 9.2 and PHP 8.4
Since Flow 9.2, singletons are handed out as native lazy proxies on PHP 8.4. They only build the real object once one of its properties is accessed. SentryClient::getSentryClient() from PunktDe.Sentry.Flow reads no property, so on an untouched proxy it returns null, and ./flow sentry:test reports "The Sentry client could not be initialized properly" although Sentry is configured. Error reporting itself was never affected.
Medienreaktor\Sentry\Aspect\LazySentryClientAspect initializes the proxy before getSentryClient() runs. On older PHP versions it does nothing.
License
This package is open source software. For license information, please see the LICENSE file.
Credits
Built by Medienreaktor to optimize Sentry integration.
Based on PunktDe.Sentry.Neos by punkt.de.