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

Fix TypeError during instrumentation #215

Conversation

DullReferenceException
Copy link
Contributor

We've been receiving errors like the following, which are crashing our processes:

TypeError: Cannot read property 'transaction' of null
    at Layer.wrappedLayerHandleRequest [as handle_request] (/src/node_modules/newrelic/lib/instrumentation/express.js:305:35)
    at /src/node_modules/express/lib/router/index.js:277:22
    ...

It appears that, for whatever reason, tracer.getSegment() is returning null, and execution of the following line of code when this happens causes an unhandled error. This adds a simple null/undefined check to avoid that and continue with the request the same way as with an inactive transaction.

We've been receiving errors like the following, which are crashing our processes:

```
TypeError: Cannot read property 'transaction' of null
    at Layer.wrappedLayerHandleRequest [as handle_request] (/src/node_modules/newrelic/lib/instrumentation/express.js:305:35)
    at /src/node_modules/express/lib/router/index.js:277:22
    ...
```

It appears that, for whatever reason, `tracer.getSegment()` is returning null, and execution of the following line of code when this happens causes an unhandled error. This adds a simple null/undefined check to avoid that and continue with the request the same way as with an inactive transaction.
@lykkin
Copy link
Contributor

lykkin commented Apr 6, 2016

Hey @DullReferenceException, thanks for bringing this to our attention, and apologies for the issue!

I'll roll this patch into the next release.

@lykkin
Copy link
Contributor

lykkin commented Apr 7, 2016

This was merged out of band in v1.26.2, thanks again!

@lykkin lykkin closed this Apr 7, 2016
@DullReferenceException
Copy link
Contributor Author

Thanks for the fast response!

bizob2828 added a commit to bizob2828/node-newrelic that referenced this pull request Apr 19, 2024
bizob2828 added a commit to bizob2828/node-newrelic that referenced this pull request Apr 23, 2024
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

Successfully merging this pull request may close these issues.

None yet

3 participants