Ao tentar fazer build de uma aplicação NextJS, dá esse erro:
...
[12:20:24.704] info - Checking validity of types...
[12:20:30.938] info - Creating an optimized production build...
[12:20:51.864] info - Compiled successfully
[12:20:51.865] info - Collecting page data...
[12:20:52.703] node:internal/child_process/serialization:127
[12:20:52.703] const string = JSONStringify(message) + '\n';
[12:20:52.703] ^
[12:20:52.703]
[12:20:52.703] TypeError: Converting circular structure to JSON
[12:20:52.704] --> starting at object with constructor 'Socket'
[12:20:52.704] | property '_httpMessage' -> object with constructor 'ClientRequest'
[12:20:52.704] --- property 'socket' closes the circle
[12:20:52.704] at stringify (<anonymous>)
[12:20:52.704] at writeChannelMessage (node:internal/child_process/serialization:127:20)
[12:20:52.704] at process.target._send (node:internal/child_process:839:17)
[12:20:52.704] at process.target.send (node:internal/child_process:739:19)
[12:20:52.704] at reportError (/vercel/path0/node_modules/next/dist/compiled/jest-worker/processChild.js:1:1995)
[12:20:52.704] at reportClientError (/vercel/path0/node_modules/next/dist/compiled/jest-worker/processChild.js:1:1671)
[12:20:52.704] at processTicksAndRejections (node:internal/process/task_queues:96:5)
[12:20:52.817] node:internal/child_process/serialization:127
[12:20:52.817] const string = JSONStringify(message) + '\n';
[12:20:52.818] ^
[12:20:52.818]
[12:20:52.818] TypeError: Converting circular structure to JSON
[12:20:52.818] --> starting at object with constructor 'Socket'
[12:20:52.819] | property '_httpMessage' -> object with constructor 'ClientRequest'
[12:20:52.819] --- property 'socket' closes the circle
...
Alguém sabe como resolver isso e o que causa?