Skip to content

Do not call JSON.stringify() for circular structures #21

@binarykitchen

Description

@binarykitchen

This library is throwing a new error we haven't seen before:

TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Socket'
| property '_httpMessage' -> object with constructor 'ClientRequest'
--- property 'socket' closes the circle
at JSON.stringify ()
at /var/www/videomail/production/source/node_modules/errormailer/index.js:107:57

It's this code line

locals.errorProperties[property] = JSON.stringify(errorToBeSent[property])

Let's fix this in a small PR by not calling JSON.stringify and consider another more robust npm package.

Maybe fast-safe-stringify or does anyone have a better idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions