Skip to content

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

Open
stuk88 wants to merge 1 commit into
rollbar:masterfrom
stuk88:master
Open

move rollbar _createItem to top.. (remove error _createItem not defined)#792
stuk88 wants to merge 1 commit into
rollbar:masterfrom
stuk88:master

Conversation

@stuk88

@stuk88 stuk88 commented Oct 17, 2019

Copy link
Copy Markdown

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
Copy Markdown
Contributor

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

@stuk88

stuk88 commented Dec 8, 2019

Copy link
Copy Markdown
Author

@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

@Th3Un1q3 Th3Un1q3 left a comment

Copy link
Copy Markdown

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
Copy Markdown

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

lopugit commented Jul 22, 2021

Copy link
Copy Markdown

PLEASE MERGE THIS HOLY SHIT

@lopugit

lopugit commented Jul 22, 2021

Copy link
Copy Markdown

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
Copy Markdown
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

javorosas commented Sep 30, 2021

Copy link
Copy Markdown

I'm getting this error in my logs

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

@arturbani

Copy link
Copy Markdown

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

@allan-cannon

Copy link
Copy Markdown

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