Skip to content

move rollbar _createItem to top.. (remove error _createItem not defined) #792

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stuk88
Copy link

@stuk88 stuk88 commented Oct 17, 2019

In node 8.16 the lib is making an error _createItem is not defined. moved the function defintion to top to fix it.

@waltjones
Copy link
Contributor

@stuk88 Can you tell me more about the error? I'm not aware of this generating an error in node.

@stuk88
Copy link
Author

stuk88 commented Dec 8, 2019

@stuk88 Can you tell me more about the error? I'm not aware of this generating an error in node.

_createItem is not defined

image

Copy link

@Th3Un1q3 Th3Un1q3 left a comment

Choose a reason for hiding this comment

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

Please merge this, the same error appears.

@terencehonles
Copy link

My guess this is an error during initialization. A complete stack trace rather than just the image of the offending frame would probably be more helpful if anyone else sees this (I don't use JS on the server and therefore haven't run into this)

@lopugit
Copy link

lopugit commented Jul 22, 2021

PLEASE MERGE THIS HOLY SHIT

@lopugit
Copy link

lopugit commented Jul 22, 2021

I believe the actual root cause for this issue is passing rollbar.error in as a callbak function.

Say with a new Promise((res,rej)=>{rej()}).catch(rollbar.error)

the this context is broken

@waltjones
Copy link
Contributor

@lopugit Thanks for that observation. I'll try it and see what I get.

As for this PR, there are some reasons not to merge as is. The style throughout the project favors putting helper functions at the end of the file whether on the prototype or not. I don't have insight yet about why only _createItem would be causing a problem. Also, I don't approve/merge things without a known repro case, and until now I haven't had insight about how or why this issue happens. I've never (yet) seen it myself.

@javorosas
Copy link

javorosas commented Sep 30, 2021

I'm getting this error in my logs

Screen Shot 2021-09-30 at 11 42 18 PM

@arturbani
Copy link

Please merge this, it's happening a lot still in 2024

@allan-cannon
Copy link

This is still happening and it appears the issue is indeed broken this context as stated above.

This code throws an error:

const logger = {
  info: rollbar.info,
  warn: rollbar.warn,
  error: rollbar.error,
};

// This line throws an error: TypeError: this._createItem is not a function
logger.error('Test error');

While this code does not:

const logger = {
  info: (...args) => rollbar.info(...args),
  warn: (...args) => rollbar.warn(...args),
  error: (...args) => rollbar.error(...args),
};

// Now this line does not throw an error
logger.error('Test error');

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.

8 participants