vidit-sh/redux-sentry-middleware

Cannot see redux store in the additional data section in Sentry

jelaxshan opened this issue · 7 comments

import * as Sentry from '@sentry/browser';
import * as createSentryMiddleware from 'redux-sentry-middleware';
import { combineReducers, createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import reducers from './reducers';

export const store = createStore(
  reducers,
  composeWithDevTools(
    applyMiddleware(
      createSentryMiddleware(Sentry),
    ),
  ),
); 

Using typescript. Am I doing something wrong here in the setup?

Would you please format this to better reading ??
createSentryMiddleware(Sentry, {}) works for you ?

Another thing is strange composeWithDevTools() returns a function, so you should call something like this:

const composeEnhancers = composeWithDevTools({
  // options like actionSanitizer, stateSanitizer
});
const middlewares = [
 createSentryMiddleware(Sentry)
];
const store = createStore(reducer, composeEnhancers(
  applyMiddleware(...middlewares),
));

@jelaxshan by the look, nothing seems wrong here.
Did you get Sentry running in your app? As in are you able to capture exceptions?

I got sentry working, but not seeing the redux state in the additional data section

Seems to be working now. I initialised Sentry in another file before, so have added the initialisation step in the same file. Rookie mistake

what was your exact problem here ?

I am facing something similar

got the issue in my case, I was calling and adding the middleware before initializing Sentry