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

circular objects blow stack #24

Open
timoxley opened this issue Jan 24, 2015 · 3 comments
Open

circular objects blow stack #24

timoxley opened this issue Jan 24, 2015 · 3 comments

Comments

@timoxley
Copy link
Contributor

need to https://www.npmjs.com/package/destroy-circular or something

@aalexgabi
Copy link

aalexgabi commented Jan 18, 2017

I can't believe it. The logging library bunyan-gelf uses flat module (https://github.com/craftti/bunyan-gelf/blob/master/lib/bunyan-gelf.js) and it crashes the process when objects containing circular references are given. This is a serious problem in my opinion because depending on the data you send to a function you process crashes.

@ianstormtaylor
Copy link

Also wishing this was supported, just realized my own logger has the same issue.

@sgrasso
Copy link

sgrasso commented Feb 20, 2019

I would suggest sanitizing the data prior to calling Flat.

You can use something like fast-safe-stringify and follow their replacer example. It will still keep it as an object but will replace the circular reference with "[Circular]" {"a":1,"o":"[Circular]"}
https://github.com/davidmarkclements/fast-safe-stringify#readme

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

No branches or pull requests

5 participants
@timoxley @ianstormtaylor @aalexgabi @sgrasso and others