rollbar / rollbar/rollbar-react
Cannot read properties of undefined (reading 'context')
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 46
- Forks
- 9
- Avg merge
- 2d 56m
- Merged PRs (30d)
- 4
Description
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.
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:
rollbar@2.26.2@rollbar/react@0.11.2
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/rollbar-context.js at componentDidMount, then compare its access to rollbar.options.payload.context with the reported rollbar@2.26.2 and @rollbar/react@0.11.2 setup. Reproduce the failure using the shown Provider and RollbarContext structure; done means mounting RollbarContext no longer throws when the reported configuration is used.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend, observability
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100