You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Paste the code at the end of this issue into a js file
Ensure rollbar is installed (npm install rollbar)
run ROLLBAR_ACCESS_TOKEN=<token> node <file>.js
Result: The error is not reported to rollbar. Instead, a new exception is thrown within rollbar's merge function, which is currently not capable of dealing with cyclic references in the custom object passed to it. This error message is shown on the console:
Uncaught Exception thrown RangeError: Maximum call stack size exceeded
at merge (/home/dev/Documents/src/rollbar-cyclic-object-crash/node_modules/rollbar/src/merge.js:1:1)
at merge (/home/dev/Documents/src/rollbar-cyclic-object-crash/node_modules/rollbar/src/merge.js:44:26)
at merge (/home/dev/Documents/src/rollbar-cyclic-object-crash/node_modules/rollbar/src/merge.js:44:26)
at merge (/home/dev/Documents/src/rollbar-cyclic-object-crash/node_modules/rollbar/src/merge.js:44:26)
at merge (/home/dev/Documents/src/rollbar-cyclic-object-crash/node_modules/rollbar/src/merge.js:44:26)
at merge (/home/dev/Documents/src/rollbar-cyclic-object-crash/node_modules/rollbar/src/merge.js:44:26)
at merge (/home/dev/Documents/src/rollbar-cyclic-object-crash/node_modules/rollbar/src/merge.js:44:26)
at merge (/home/dev/Documents/src/rollbar-cyclic-object-crash/node_modules/rollbar/src/merge.js:44:26)
at merge (/home/dev/Documents/src/rollbar-cyclic-object-crash/node_modules/rollbar/src/merge.js:44:26)
at merge (/home/dev/Documents/src/rollbar-cyclic-object-crash/node_modules/rollbar/src/merge.js:44:26)
Expected result:
Rollbar's merge() function used on the custom object paramter should probably deal with cyclic references. I believe Rollbar's scrubbing is already set up to handle cyclic references, so similar logic can probably be used here on the custom object?
code:
const Rollbar = require("rollbar");
const rollbar = new Rollbar({
accessToken: process.env.ROLLBAR_ACCESS_TOKEN,
enabled: true,
environment: "production",
});
process.on('uncaughtException', err => {
console.error('Uncaught Exception thrown', err);
})
const testError = new Error("test error");
// Prepare a custom object to log to rollbar, and include a cyclic reference
const objA = {}
const objB = {}
objA.objB = objB;
objB.objA = objA;
// TODO: This causes rollbar itself to throw an error, as rollbar.js doesn't have anything
// in place to handle cyclic references in the custom object passed to it.
// Perhaps it should?
rollbar.error("error!", testError, objA); // Report an error to rollbar, and include a custom object with it.
The text was updated successfully, but these errors were encountered:
Repro:
npm install rollbar
)ROLLBAR_ACCESS_TOKEN=<token> node <file>.js
Result: The error is not reported to rollbar. Instead, a new exception is thrown within rollbar's merge function, which is currently not capable of dealing with cyclic references in the custom object passed to it. This error message is shown on the console:
Expected result:
Rollbar's merge() function used on the custom object paramter should probably deal with cyclic references. I believe Rollbar's scrubbing is already set up to handle cyclic references, so similar logic can probably be used here on the custom object?
code:
The text was updated successfully, but these errors were encountered: