GithubHelp home page GithubHelp logo

ngokevin / redux-raven-middleware Goto Github PK

View Code? Open in Web Editor NEW
227.0 6.0 25.0 17 KB

:bird: Redux middleware for sending error reports to Sentry through raven-js.

License: MIT License

JavaScript 100.00%

redux-raven-middleware's Introduction

redux-raven-middleware

Also check out Raven for Redux.

Redux middleware for sending error reports to Sentry through raven-js.

Will automatically send an error report upon encountering a Javascript error on dispatching any action. redux-raven-middleware will pass in the error as well as extra information such as the action that caused the error and the entire Redux application state.

RavenMiddleware(sentryDSN, sentryConfig, middlewareOptions)

Creates a Raven Middleware.

  • sentryDSN -- string representing your Sentry instance.
  • sentryConfig -- object that will be passed into Raven.config.
  • middlewareOptions -- object to customize the middleware:
    • actionTransformer -- transform the action before sending to Sentry
    • stateTransformer -- transform the state before sending to Sentry
    • logger -- log function to use instead of console.error
import {applyMiddleware, createStore} from 'redux';
import RavenMiddleware from 'redux-raven-middleware';


const createStoreWithMiddleware = applyMiddleware(
  RavenMiddleware('my-sentry-dsn')
)(createStore);

redux-raven-middleware's People

Contributors

benvinegar avatar captbaritone avatar ngokevin avatar secobarbital avatar ychua avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

redux-raven-middleware's Issues

showReportDialog

What's the recommended approach to trigger the showReportDialog feature on error?

Configuration to add environment to Sentry errors

How do I go about adding the environment (development/production) to the Sentry error with this library?

I tried doing this but it doesn't seem to work:

RavenMiddleware(process.env.SENTRY_URL, {
  environment: process.env.NODE_ENV
})

configuration option to weather or not to include the whole action

right now, in breadcrumb, message is always action.type need to provide a configuration option, so that users can also send action, instead of just action.type.

The end goal here is to replay the bug report on our browser the exact same way user did, so reproducing the bug becomes really easy.

413 (Request Entity Too Large)

Any ideas why I might be hitting this? My source maps are well under the limit (largest is 1.5mb). My sourcemaps are hosted on sentry and not uploaded to aws.

The request looks normal to me:
sentry

[email protected]
sentry_version:7
sentry_client:raven-js/3.12.0

Raven is not configured

When loading the Redux Raven Middleware as described the console says:

Error: Raven has not been configured.

When trying to initialise Raven from the same console it says it's already configured:

window.Raven.config('https://[email protected]/53909', {}).install();

Error: Raven has already been configured

I tracked down the afterLoad function doesn't know of window.RavenConfig .. could this be a clue as to what's wrong?

Publish new version (0.4.0?)

Hey there,

It would be nice if you could cut a new version of redux-raven-middleware that represents the current state of the repo:

  • breadcrumb collection
  • latest version of Raven.js (which introduces breadcrumbs, POST requests so more data can be sent, etc)

Right now the latest version on npm is 0.3.0, which is 11 months old.

If you need a hand maintaining this library, I'd be glad to come on as a contributor (I maintain raven-js on behalf of Sentry).

Scrubbing State

How do we scrub state before posting to sentry with this middleware?

Additional Data section of Sentry doesn't show current state and the action

The source code shows that if there is an error then the Raven extra fields should have action and current state - store.getState().
However, when intentionally raising an error in my code to catch in Sentry:

  componentWillMount() {
    nonExistingFunctionCalled();
  }

Sentry states only about the session:duration and no any information can be found about action and state.

Here is a screenshot:

screen shot 2015-10-02 at 09 19 54

Missing documentation explicit send of errors

I see the mention of the "logger" on the readme.
I can't seem to find out how to use that.

In some places in my code, I would like to catch an exception, but still send something to sentry, is there an easy way to do that using the plugin?

Issue with server side rendering

var _Raven = window.Raven; errors out when server side rendering is done.

When we import import ravenMiddleware from 'redux-raven-middleware'; for redux integration with raven, server side doesn't have window object due to which the above mentioned line errors out.

We can add conditional execution of this middleware but since the declaration is done at compile time we're unable to escape that

Enable Travis

@ngokevin Would you be able to enable Travis for this repository? I don't believe I currently have permission to do so.

If you can enable it for the repo, I'd be happy to add the .travis.yml.

Thanks!

Consider switching to a model where Raven is injected

A number of the issues here revolve around configuring/handling the instance of Raven. I have yet another issue in that same vein. We load Raven in it's own script tag (to catch Webpack bundle issues, CDN loading issues and other load-time issues) and therefore we already have Raven loaded.

Obviously this would present a breaking change, but we could offer a second module which implements the existing behavior (basically it would include Raven from node_modules and configure it using the existing cfg object.

Thoughts?

I'd be happy to provide the pull request if you like this idea.

Possibility to filter breadcrumbs

Hi, I would like to know your opinion on a simple feature, that would allow me to filter which actions will be captured to breadcrumbs.

Usage

It could be a new option:

const options = {
  breadcrumbFilter = action => action.type !== 'SOME_BANAL_ACTION',
};

const createStoreWithMiddleware = applyMiddleware(
  RavenMiddleware('my-sentry-dsn', options)
)(createStore);

I would be happy to prepare a pull-request if you approve the feature.

Motivation

I work on an app, that periodically (several times in a second) checks if some external value didn't change from the stored value. Redux way would be to always dispatch an action with current value and move the comparison to the reducer.

But that would generate huge mess in the breadcrumbs, so instead we call some function, that compares current value to the state value and only if it differs, then it dispatches a new action to change the state.

Update to raven 3.1.1

Hi, just to let you know that the currently version of rave is 3.1.1 and contains some bug fixes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.