Uncaught TypeError: Converting circular structure to JSON
See original GitHub issueDescribe the bug
When using the DiscussionEmbed component this error is generated:
Uncaught TypeError: Converting circular structure to JSON
--> starting at object with constructor 'ReactCompositeComponentWrapper'
| property '_instance' -> object with constructor 'App'
--- property '_reactInternalInstance' closes the circle
at JSON.stringify (<anonymous>)
at b.Channel.h.sendMessage (embed.js:44)
at e.<anonymous> (embed.js:45)
at e.<anonymous> (embed.js:44)
at e.<anonymous> (embed.js:44)
at m (embed.js:44)
at e.trigger (embed.js:44)
at e.<anonymous> (embed.js:44)
at m (embed.js:44)
at b.Channel.trigger (embed.js:44)
It appears that embed.js is trying to stringify the config to use sendMessage, which includes a reference to the DIV container for the discussion, but that includes react references in it which are circular.
To Reproduce
Steps to reproduce the behavior:
- Clone this repo
- npm i && npm run build:example && npm start
- Navigate to examples, go to an article with a discussion
- See error in console
Expected behavior
No error
Specifications:
I assume it’d happen on a few platforms but mine specifically are:
- OS: MacOS 10.15.7
- Package version: latest
- Node version: 12
- Browser: Chrome 87
Additional context
Not sure if it’s an issue with this package or disqus’s embed.js no longer playing nice with react, either way it needs to be solved by disqus.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:16 (7 by maintainers)
Top 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
JSON does not support object references, so trying to stringify a JSON object that references itself will result in a typeerror. It is...
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. To solve...
Read more >converting circular structure to json --> starting at object with ...
The JSON.stringify method does not support circular references, so we have to remove them before converting the object to JSON. If you spot...
Read more >query* causes TypeError: Converting circular structure to JSON
The error seems to happen when HTML elements are passed to expect as a value to be compared. When an assertion fails jest...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The fix just went out, so I would expect that you should stop seeing these issues once the caches clear. I’m going to leave this issue open for the next couple of days to make sure the problem doesn’t persist for anyone and then I’ll close it out.
I’ve made the team aware of this issue and we’re going to try to track down the cause ASAP.