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

[shim] Fix TypeError: segment.transaction.isActive is not a function #282

Closed
wants to merge 1 commit into from

Conversation

ali-essam
Copy link

CHANGE LOG

  • [shim] Fix TypeError: segment.transaction.isActive is not a function

INTERNAL LINKS

NOTES

@lasergoat
Copy link

I am also getting this error:

{ level: 'info',
  source: 'skynet',
  status: 200,
  route: null,
  data: 
   { message: 'get call to https://sandbox-quickbooks.api.intuit.com/v3/company/4620816365008403470/query?query=SELECT%20*%20FROM%20Preferences%20STARTPOSITION%200%20MAXRESULTS%201000&minorversion=37 for QBO realm id 4620816365008403470' },
  timestamp: '2019-08-15T15:01:26.468Z',
  operationId: '65a7e071-cb4e-44bd-9cf1-213c65ab0f86' }
TypeError: segment.transaction.isActive is not a function
    at Shim.getActiveSegment (/var/app/current/node_modules/newrelic/lib/shim/shim.js:1329:61)
    at AsyncHook.afterHook (/var/app/current/node_modules/newrelic/lib/instrumentation/core/async_hooks.js:88:31)
    at emitAfterNative (async_hooks.js:402:40)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)
    at process.wrappedProcess (/var/app/current/node_modules/newrelic/lib/instrumentation/core/timers.js:15:21)

any word on including this? If the agent is going to be throwing unhandled exceptions, I don't think we can use New Relic for these projects.

@bkapus2
Copy link

bkapus2 commented Aug 28, 2019

I'm not sure how consumers of node-newrelic would view missing logs if this does happen. This feels like it is sweeping the issue under the rug and gives it less urgency. If logs are not getting where they need to go, I'd rather know about it. Maybe add console.warns (although that also feels dirty).

@astormnewrelic
Copy link
Contributor

@lasergoat We're definitely interested in fixing this -- are you able to reproduce this issue on command? With code you can share? If so we'd love to get a reproducible case -- once we have that we'll be better able to asses the full impact of ali-essam (generous) fix.

@@ -1326,7 +1326,9 @@ function getSegment(obj) {
*/
function getActiveSegment(obj) {
var segment = this.getSegment(obj)
if (segment && segment.transaction && segment.transaction.isActive()) {
if (segment && segment.transaction &&
Copy link

@gevertex gevertex Oct 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should else this with some instrumentation to send a stack trace and other diagnostics to NewRelic so that all of the instances of this problem can be aggregated and give NewRelic devs more information about how to fix this and the code paths involved. That way though the data does get dropped in these cases, we learn something each time it happens and it can be quantified.

I doubt the built in object can be used in these cases, so you might need to implement something more custom, or instantiate a new instance, or something like that. Dirty but temporary and probably very useful.

@michaelgoin
Copy link
Member

With version 5.13.0 we made the segment reference we add to the output request non-enumerable to hopefully avoid these issues.

Has anyone upgraded and are they still having issues? We'd like to continue to focus on the root cause(s) of the issue and won't be landing this PR as-is.

We do appreciate the contribution. Please let us know in the other issue if this continues to be a problem. Issue: #281

Thank you,

Michael

@lasergoat
Copy link

@astormnewrelic sorry I didn't reply already. I wish I'd been more of a help for you. I ended up just leaving the agent in as-is, and forgetting about the issue. I haven't seen the error since.

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

[Bug] unhandledException TypeError: segment.transaction.isActive is not a function
6 participants