question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Converting circular structure to JSON error

See original GitHub issue

Hello,

First of all, thank you for the great product. It’s pleasure to create fancy CLI output using it.

In recent versions, we faced a problem when an error happening in a listr task. If context contains objects with circular reference, another error throws by JSON.stringify: Converting circular structure to JSON.

It goes from cloneObject function:

    at cloneObject (/~/Dash/dashmate/node_modules/listr2/dist/utils/general.js:8:28)
    at TaskWrapper.report (/~/Dash/dashmate/node_modules/listr2/dist/lib/task-wrapper.js:50:104)
    at Task.run (/~/Dash/dashmate/node_modules/listr2/dist/lib/task.js:266:29)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async /~/Dash/dashmate/node_modules/p-map/index.js:57:22

I would recommend to use lodash’s cloneDeep or alternatives instead of JSON.parse(JSON.stringify).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
cenk1cenk2commented, Nov 2, 2021

🎉 This issue has been resolved in version 3.13.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

0reactions
ejnshteincommented, Nov 1, 2021

Hi!

We have functions that allow modifying tasks inside. Functions return task bodies (so object with title, task, e.t.c.)

And so this error comes up.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Converting circular structure to JSON - Stack ...
It means that the object you pass in the request (I guess it is pagedoc ) has a circular reference, something like: var...
Read more >
Converting Circular Structure to JSON - Career Karma
Error When Trying to Convert Circular Structures into JSON ... JSON does not support object references, so trying to stringify a JSON object...
Read more >
TypeError: Converting circular structure to JSON in JS
The "Converting circular structure to JSON" error occurs when we pass an object that contains circular references to the JSON.stringify() method.
Read more >
How to fix TypeError: Converting circular structure to JSON in ...
To fix this error, you need to make sure that your objects don't contain circular references. One way to do this is to...
Read more >
Converting circular structure to JSON" error occurs when a ...
Steps to reproduce: ... Current results: The "Uncaught TypeError: Converting circular structure to JSON" or "Maximum call stack error" error ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found