Everything works great until I actually try to build the site and deploy it. It looks like I have a self-referential variable, but I can’t figure out what it could be for the life of me and this error message isn’t giving me any clues:
node:internal/child_process/serialization:159
const string = JSONStringify(message) + ‘\n’;
^
TypeError: Converting circular structure to JSON
–> starting at object with constructor ‘Socket’
| property ‘_httpMessage’ -> object with constructor ‘ClientRequest’
— property ‘socket’ closes the circle
at stringify (<anonymous>)
at writeChannelMessage (node:internal/child_process/serialization:159:20)
at process.target._send (node:internal/child_process:840:17)
at process.target.send (node:internal/child_process:740:19)
at reportError (C:\Users\user\OneDrive\Documents\GitHub\ecommerce2\node_modules\next\dist\compiled\jest-worker\processChild.js:1:1993)
at reportClientError (C:\Users\user\OneDrive\Documents\GitHub\ecommerce2\node_modules\next\dist\compiled\jest-worker\processChild.js:1:1669)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
node:internal/child_process/serialization:159
const string = JSONStringify(message) + ‘\n’;
^
TypeError: Converting circular structure to JSON
–> starting at object with constructor ‘Socket’
| property ‘_httpMessage’ -> object with constructor ‘ClientRequest’
— property ‘socket’ closes the circle
at stringify (<anonymous>)
at writeChannelMessage (node:internal/child_process/serialization:159:20)
at process.target._send (node:internal/child_process:840:17)
at process.target.send (node:internal/child_process:740:19)
at reportError (C:\Users\user\OneDrive\Documents\GitHub\ecommerce2\node_modules\next\dist\compiled\jest-worker\processChild.js:1:1993)
at reportClientError (C:\Users\user\OneDrive\Documents\GitHub\ecommerce2\node_modules\next\dist\compiled\jest-worker\processChild.js:1:1669)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
node:internal/child_process/serialization:159
const string = JSONStringify(message) + ‘\n’;
^
TypeError: Converting circular structure to JSON
–> starting at object with constructor ‘Socket’
| property ‘_httpMessage’ -> object with constructor ‘ClientRequest’
— property ‘socket’ closes the circle
at stringify (<anonymous>)
at writeChannelMessage (node:internal/child_process/serialization:159:20)
at process.target._send (node:internal/child_process:840:17)
at process.target.send (node:internal/child_process:740:19)
at reportError (C:\Users\user\OneDrive\Documents\GitHub\ecommerce2\node_modules\next\dist\compiled\jest-worker\processChild.js:1:1993)
at reportClientError (C:\Users\user\OneDrive\Documents\GitHub\ecommerce2\node_modules\next\dist\compiled\jest-worker\processChild.js:1:1669)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
node:internal/child_process/serialization:159
const string = JSONStringify(message) + ‘\n’;
^
TypeError: Converting circular structure to JSON
–> starting at object with constructor ‘Socket’
| property ‘_httpMessage’ -> object with constructor ‘ClientRequest’
— property ‘socket’ closes the circle
at stringify (<anonymous>)
at writeChannelMessage (node:internal/child_process/serialization:159:20)
at process.target._send (node:internal/child_process:840:17)
at process.target.send (node:internal/child_process:740:19)
at reportError (C:\Users\user\OneDrive\Documents\GitHub\ecommerce2\node_modules\next\dist\compiled\jest-worker\processChild.js:1:1993)
at reportClientError (C:\Users\user\OneDrive\Documents\GitHub\ecommerce2\node_modules\next\dist\compiled\jest-worker\processChild.js:1:1669)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
> Build error occurred
Error: Call retries were exceeded
at ChildProcessWorker.initialize (C:\Users\user\OneDrive\Documents\GitHub\ecommerce2\node_modules\next\dist\compiled\jest-worker\index.js:1:12037)
at ChildProcessWorker._onExit (C:\Users\user\OneDrive\Documents\GitHub\ecommerce2\node_modules\next\dist\compiled\jest-worker\index.js:1:12975)
at ChildProcess.emit (node:events:513:28)
at ChildProcess.emit (node:domain:489:12)
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12) {
type: ‘WorkerError’
}
you are try to convert a js object to JSON to send over socket.io
you can send only simple object not complex object with not primitive data type.
try to find that object and make it simple like {key: ‘value’} and try again.


hello there,
thanks for your interest.
yes I wanted to update the course with latest next and tailwind and add new features like inventory management and order handling.
Hey Basir,
Thank you for responding to my question. I went through my build and analyzed it piece by piece as I had added a few things in addition to your tutorial, and I found that it was my attempt to provide Square as a payment method. Everything was fine after I took that out– even with my other additional features. (Stripe and Paypal have proven much superior to Square.)
Overall, I really enjoyed the tutorial. I bought the class even though I had finished my build without the additional material simply because I wanted to support you. Great job, man! Do you plan on doing more work on the tailwind build, the mui version, or will you be doing something else in the future?
Thank you for the great tutorial,
Jesse