Error 'Circular structure' when run on the server?

NEXTJS - when you start the local server everything works, but when run on a remote test get error

Circular structure in "getInitialProps" result of page/home. https://err.sh/zeit/next.js/circular-structure


Code

Home.getInitialProps = async ({ reduxStore, query }) => {
 const type = query.type || reduxStore.getState().app.type;
 await reduxStore.dispatch(initPage(query));

 return {
 namespacesRequired: ['common'],
type
};
};
March 23rd 20 at 19:20
1 answer
March 23rd 20 at 19:22
Solution
See the contents of the store. You either write cyclic data structures, or write any object libraries containing similar data.
If you write store own helper that uses a third party library, which be re-created on the client, then implement the toJSON method:
toJSON() {
 return '[Helper Name]';
}
@Nick75, create a method mapError(error), which will collect only the necessary data from the returned object. The object contains cyclic data, they cannot be converted to a string, and the client they are passed in this form. - Nicol commented on March 23rd 20 at 19:25

Find more questions by tags React