Redux middleware for sending error reports to Sentry through raven-js. This package, currently at version 1.2.0, was last published in January 2017, making it effectively abandoned. It automatically intercepts JavaScript errors that occur during action dispatch, capturing the error, the action that caused it, and the entire Redux application state for detailed crash reports. A key differentiating feature at the time was its deep integration with Redux state for context. However, its core dependency, `raven-js`, was officially deprecated by Sentry in Q2 2020 in favor of the modern `@sentry/browser` SDK. This means while the middleware itself may technically still function with older Sentry setups, it relies on a legacy library that no longer receives updates and lacks many features of the current Sentry ecosystem. Users should consider migrating to `redux-sentry-middleware` or a custom solution built with `@sentry/browser` for modern Sentry integration.
npm install redux-raven-middlewareVerified import paths — ran on the pinned version, not inferred.
Demonstrates setting up `redux-raven-middleware` with `applyMiddleware`, including options for transforming actions and state, and intentionally triggering an error to show Sentry integration.
Migrate to `redux-sentry-middleware` or implement a custom Redux middleware using `@sentry/browser` or `@sentry/react` (for React applications) to ensure compatibility with current Sentry features and security updates.
Consider alternatives like `redux-sentry-middleware` which is an API-compatible fork supporting the modern Sentry SDKs, or roll your own integration using the official Sentry SDKs.
Utilize the `stateTransformer` option within the middleware to prune or serialize the state before sending, including only relevant debugging information. For example, `{ stateTransformer: state => ({ user: state.user.id, currentRoute: state.router.location.pathname }) }`.Ensure `RavenMiddleware` is one of the first arguments passed to `applyMiddleware` in your Redux store configuration.
When migrating to modern Sentry SDKs, review Sentry's current documentation for setting user context, tags, and extra data, which typically involves `Sentry.setUser()`, `Sentry.setTag()`, `Sentry.setContext()`, or using `beforeSend` callbacks.
Ensure `raven-js` is properly configured and installed before the Redux store is created and `redux-raven-middleware` is applied. Check for duplicate `raven-js` bundles or incorrect DSNs.
Use the `stateTransformer` and `actionTransformer` options to filter, redact, or reduce the size of the Redux state and action objects before they are sent to Sentry.
Verify that `raven-js` is correctly installed, imported, and initialized in your application. If `raven-js` is loaded via a `<script>` tag, ensure it's loaded before your application code that uses `redux-raven-middleware`.