Call to Node module failed with error: TypeError: Converting circular structure to JSON #711

Closed
opened 2025-08-09 17:17:22 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @Maarten88 on 5/29/2017

I am trying to implement webpack code splitting in a React-Redux based Javascriptservices project.

So I created an asyncComponent using one of the many samples on the web, and made a simple Contact page load dynamically, like this:

const AsyncContact = asyncComponent(() => 
    System.import('./components/Contact').then(module => module.default));

This works, both client-side and serverside.

For a more complex page, with a lot of dependencies, I implemented the same, now with dynamic reducers. and a large Chat component on it. Clientside this page runs without error, but it results in an error when run serverside:

Call to Node module failed with error: TypeError: Converting circular structure to JSON

This error seems to come from here:
https://github.com/aspnet/JavaScriptServices/blob/dev/src/Microsoft.AspNetCore.NodeServices/Content/Node/entrypoint-http.js#L78

If I refresh the page, the second time the same page renders succesfully.

I guess my webpack chunk has circular references. I tried to find out which, but I don't know how to debug this. I think Javascript should normally handle circular references, the browser has no problems with it.

*Originally created by @Maarten88 on 5/29/2017* I am trying to implement webpack code splitting in a React-Redux based Javascriptservices project. So I created an asyncComponent using one of the many samples on the web, and made a simple Contact page load dynamically, like this: const AsyncContact = asyncComponent(() => System.import('./components/Contact').then(module => module.default)); This works, both client-side and serverside. For a more complex page, with a lot of dependencies, I implemented the same, now with dynamic reducers. and a large Chat component on it. Clientside this page runs without error, but it results in an error when run serverside: Call to Node module failed with error: TypeError: Converting circular structure to JSON This error seems to come from here: https://github.com/aspnet/JavaScriptServices/blob/dev/src/Microsoft.AspNetCore.NodeServices/Content/Node/entrypoint-http.js#L78 If I refresh the page, the second time the same page renders succesfully. I guess my webpack chunk has circular references. I tried to find out which, but I don't know how to debug this. I think Javascript should normally handle circular references, the browser has no problems with it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#711
No description provided.