Redux

Installing Airbrake in a Redux application

Features

  • Easy and flexible installation options including npm and Yarn
  • Send uncaught errors to Airbrake or manually using a try/catch
  • Add custom parameters to your errors for more context
  • Private source map support
  • Control which errors you send with customizable filtering options

1. Add dependencies

npm install @airbrake/browser redux-airbrake --save

2. Import dependency

import { Notifier } from '@airbrake/browser';
import airbrakeMiddleware from 'redux-airbrake';

3. Configure & add middleware

const airbrake = new Notifier({
    projectId: 123,
    projectKey: 'abcdefg12345678'
});

const errorMiddleware = airbrakeMiddleware(airbrake);

export const store = createStore(
    rootReducer,
    applyMiddleware(
        errorMiddleware
    )
);

export default store;

The redux-airbrake middleware also supports additional options like sending last action & state to Airbrake and Adding extra details to errors before they are sent.

Going further

Installation and configuration is just the beginning. The airbrake-js notifier supports many other advanced uses and options including:

Please visit the airbrake-js GitHub repo for more usage and configuration examples.