Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read properties of undefined (reading 'context') #102

Open
hosseintalebi opened this issue Jul 11, 2023 · 2 comments
Open

Cannot read properties of undefined (reading 'context') #102

hosseintalebi opened this issue Jul 11, 2023 · 2 comments

Comments

@hosseintalebi
Copy link

hosseintalebi commented Jul 11, 2023

I'm trying to use RollbarContext and it's giving me an error on its componentDidMount function as it's trying to access rollbar.options.payload.context (see here). Looking at the rollbar.options object, there's no payload.

image

This is how I'm using the <RollbarContext>:

const rollbarConfig = {
  accessToken: '<token>',
  environment: 'testenv',
};
...
    <Provider config={rollbarConfig}>
       <ErrorBoundary>
        <Router>
          <Route path={rootPath}>
            <Switch>
              {Object.entries(routes).map(([path, route]) => {
                return (
                  <RollbarContext context={path}>
                    <LazyRoute ... />
                  </RollbarContext>
                );
              })}
              <Redirect from="*" to="/app/404" />
            </Switch>
          </Route>
        </Router>
      </ErrorBoundary>
    </Provider>

I'm using the following versions of the libraries:

@jerimiahmilton
Copy link

Running into the same issue, here's my usage:

const Chat: React.FC = () => {
  useRollbarContext('chat#list')

  return (
    <IonPage>
      <Header title='Chat' />
      <IonContent>
        <CometChatConversationsWithMessages
          isMobileView={true}
          messagesConfiguration={messageConfig}
          conversationsConfiguration={conversationConfig}
        />
      </IonContent>
    </IonPage>
  )
}

export default Chat

@mxwoz1234
Copy link

I have a similar issue.

`
const rollbarConfig = {
accessToken: 'xxxxx',
environment: 'production',
};
export default function App() {
return (

            <Router>
                <div>
                  
                       <Provider config={rollbarConfig}>
                           <ErrorBoundary
                               fallbackUI={ErrorBoundaryMessage}
                           >
                                <Suspense fallback={<LoadingAdvice/>}>
                                    <Switch>
                                        <Route path="/register/start/:guid">
                                           <RollbarContext context={'registerStart'} >
                                                <RegisterStart />
                                            </RollbarContext>
                                        </Route>
                                        

                                    </Switch>
                                </Suspense>
                           </ErrorBoundary>
                       </Provider>
                </div>
            </Router>
        </ThemeProvider>
    </StyledEngineProvider>
);

}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants