TypeError: Converting circular structure to JSON
-
I've just upgraded from v1.10.2 to v1.11.2 (luckily not on my live site) and when I try to view any categories, I get this error.
I thought I would ask about it here, before posting on the bug tracker.
2019-02-06T14:40:08.983Z [4999/26981] - error: uncaughtException: Converting circular structure to JSON TypeError: Converting circular structure to JSON at JSON.stringify (<anonymous>) at stringify (/var/****/node_modules/express/lib/response.js:1119:12) at ServerResponse.json (/var/****/node_modules/express/lib/response.js:260:14) at async.waterfall.str (/var/****/src/middleware/render.js:74:18) at nextTask (/var/****/node_modules/async/dist/async.js:5324:14) at next (/var/****/node_modules/async/dist/async.js:5331:9) at /var/****/node_modules/async/dist/async.js:969:16 at /var/****/node_modules/async/dist/async.js:473:16 at next (/var/****/node_modules/async/dist/async.js:5329:29) at /var/****/node_modules/async/dist/async.js:969:16 {"error":{},"stack":"TypeError: Converting circular structure to JSON\n at JSON.stringify (<anonymous>)\n at stringify (/var/****/node_modules/express/lib/response.js:1119:12)\n at ServerResponse.json (/var/****/node_modules/express/lib/response.js:260:14)\n at async.waterfall.str (/var/****/src/middleware/render.js:74:18)\n at nextTask (/var/****/node_modules/async/dist/async.js:5324:14)\n at next (/var/****/node_modules/async/dist/async.js:5331:9)\n at /var/****/node_modules/async/dist/async.js:969:16\n at /var/****/node_modules/async/dist/async.js:473:16\n at next (/var/****/node_modules/async/dist/async.js:5329:29)\n at /var/****/node_modules/async/dist/async.js:969:16","exception":true,"date":"Wed Feb 06 2019 14:40:08 GMT+0000 (GMT)","process":{"pid":26981,"uid":1001,"gid":1001,"cwd":"/var/****","execPath":"/usr/bin/node","version":"v8.11.2","argv":["/usr/bin/node","/var/****/app.js"],"memoryUsage":{"rss":168038400,"heapTotal":132849664,"heapUsed":96406152,"external":36713046}},"os":{"loadavg":[1.1171875,0.72021484375,0.57958984375],"uptime":3294087},"trace":[{"column":null,"file":null,"function":"JSON.stringify","line":null,"method":"stringify","native":false},{"column":12,"file":"/var/****/node_modules/express/lib/response.js","function":"stringify","line":1119,"method":null,"native":false},{"column":14,"file":"/var/****/node_modules/express/lib/response.js","function":"ServerResponse.json","line":260,"method":"json","native":false},{"column":18,"file":"/var/****/src/middleware/render.js","function":"async.waterfall.str","line":74,"method":"str","native":false},{"column":14,"file":"/var/****/node_modules/async/dist/async.js","function":"nextTask","line":5324,"method":null,"native":false},{"column":9,"file":"/var/****/node_modules/async/dist/async.js","function":"next","line":5331,"method":null,"native":false},{"column":16,"file":"/var/****/node_modules/async/dist/async.js","function":null,"line":969,"method":null,"native":false},{"column":16,"file":"/var/****/node_modules/async/dist/async.js","function":null,"line":473,"method":null,"native":false},{"column":29,"file":"/var/****/node_modules/async/dist/async.js","function":"next","line":5329,"method":null,"native":false},{"column":16,"file":"/var/****/node_modules/async/dist/async.js","function":null,"line":969,"method":null,"native":false}]}
I also get this error when trying to view any category 'admin functions' in the admin panel.
2019-02-06T14:57:40.563Z [4999/27022] - error: uncaughtException: Maximum call stack size exceeded RangeError: Maximum call stack size exceeded at Function.isBuffer (buffer.js:398:36) at hasBinary (/var/****/node_modules/has-binary2/index.js:44:66) at hasBinary (/var/****/node_modules/has-binary2/index.js:58:59) at hasBinary (/var/****/node_modules/has-binary2/index.js:37:11) at hasBinary (/var/****/node_modules/has-binary2/index.js:58:59) at hasBinary (/var/****/node_modules/has-binary2/index.js:58:59) at hasBinary (/var/****/node_modules/has-binary2/index.js:37:11) at hasBinary (/var/****/node_modules/has-binary2/index.js:58:59) at hasBinary (/var/****/node_modules/has-binary2/index.js:58:59) at hasBinary (/var/****/node_modules/has-binary2/index.js:37:11) {"error":{},"stack":"RangeError: Maximum call stack size exceeded\n at Function.isBuffer (buffer.js:398:36)\n at hasBinary (/var/****/node_modules/has-binary2/index.js:44:66)\n at hasBinary (/var/****/node_modules/has-binary2/index.js:58:59)\n at hasBinary (/var/****/node_modules/has-binary2/index.js:37:11)\n at hasBinary (/var/****/node_modules/has-binary2/index.js:58:59)\n at hasBinary (/var/****/node_modules/has-binary2/index.js:58:59)\n at hasBinary (/var/****/node_modules/has-binary2/index.js:37:11)\n at hasBinary (/var/****/node_modules/has-binary2/index.js:58:59)\n at hasBinary (/var/****/node_modules/has-binary2/index.js:58:59)\n at hasBinary (/var/****/node_modules/has-binary2/index.js:37:11)","exception":true,"date":"Wed Feb 06 2019 14:57:40 GMT+0000 (GMT)","process":{"pid":27022,"uid":1001,"gid":1001,"cwd":"/var/****","execPath":"/usr/bin/node","version":"v8.11.2","argv":["/usr/bin/node","/var/****/app.js"],"memoryUsage":{"rss":144797696,"heapTotal":113262592,"heapUsed":90477720,"external":36807213}},"os":{"loadavg":[0.447265625,0.3173828125,0.37060546875],"uptime":3295139},"trace":[{"column":36,"file":"buffer.js","function":"Function.isBuffer","line":398,"method":"isBuffer","native":false},{"column":66,"file":"/var/****/node_modules/has-binary2/index.js","function":"hasBinary","line":44,"method":null,"native":false},{"column":59,"file":"/var/****/node_modules/has-binary2/index.js","function":"hasBinary","line":58,"method":null,"native":false},{"column":11,"file":"/var/****/node_modules/has-binary2/index.js","function":"hasBinary","line":37,"method":null,"native":false},{"column":59,"file":"/var/****/node_modules/has-binary2/index.js","function":"hasBinary","line":58,"method":null,"native":false},{"column":59,"file":"/var/****/node_modules/has-binary2/index.js","function":"hasBinary","line":58,"method":null,"native":false},{"column":11,"file":"/var/****/node_modules/has-binary2/index.js","function":"hasBinary","line":37,"method":null,"native":false},{"column":59,"file":"/var/****/node_modules/has-binary2/index.js","function":"hasBinary","line":58,"method":null,"native":false},{"column":59,"file":"/var/****/node_modules/has-binary2/index.js","function":"hasBinary","line":58,"method":null,"native":false},{"column":11,"file":"/var/****/node_modules/has-binary2/index.js","function":"hasBinary","line":37,"method":null,"native":false}]} 2019-02-06T14:57:40.563Z [4999/27022] - error: Maximum call stack size exceeded RangeError: Maximum call stack size exceeded at Function.isBuffer (buffer.js:398:36) at hasBinary (/var/****/node_modules/has-binary2/index.js:44:66) at hasBinary (/var/****/node_modules/has-binary2/index.js:58:59) at hasBinary (/var/****/node_modules/has-binary2/index.js:37:11) at hasBinary (/var/****/node_modules/has-binary2/index.js:58:59) at hasBinary (/var/****/node_modules/has-binary2/index.js:58:59) at hasBinary (/var/****/node_modules/has-binary2/index.js:37:11) at hasBinary (/var/****/node_modules/has-binary2/index.js:58:59) at hasBinary (/var/****/node_modules/has-binary2/index.js:58:59) at hasBinary (/var/****/node_modules/has-binary2/index.js:37:11)
P.S. I've removed my folder name and replaced it with ****, in case you were wondering.
-
-
I just tried converting my current forum which is still on v1.10.2 again to see if its resolved with the latest node, however I'm still getting this issue when trying to view a category either in category view or on the admin panel.
Do you know how I can check the database to solve this @baris ?
-
Can you put this script in your nodebb root folder and post the output here?
It should show your category structure.
category info
category info. GitHub Gist: instantly share code, notes, and snippets.
Gist (gist.github.com)
-
@baris Thanks in advance for your help.
done { "1": { "parentCid": 0, "children": [ "281" ] }, "2": { "parentCid": 0, "children": [ "140", "12", "3", "4", "141", "190", "24" ] }, "3": { "parentCid": 2, "children": [] }, "4": { "parentCid": 2, "children": [] }, "5": { "parentCid": 0, "children": [ "36", "134", "135", "256", "198" ] }, "8": { "parentCid": 0, "children": [ "132", "231", "232" ] }, "9": { "parentCid": 0, "children": [] }, "10": { "parentCid": 0, "children": [] }, "11": { "parentCid": 0, "children": [ "49" ] }, "12": { "parentCid": 2, "children": [] }, "21": { "parentCid": 0, "children": [ "219", "223" ] }, "22": { "parentCid": 0, "children": [ "264", "265" ] }, "23": { "parentCid": 0, "children": [ "208", "229" ] }, "24": { "parentCid": 2, "children": [] }, "25": { "parentCid": 0, "children": [] }, "26": { "parentCid": 258, "children": [ "91", "191", "193", "195" ] }, "27": { "parentCid": 0, "children": [ "74", "266", "85", "69", "267", "202", "268", "276" ] }, "28": { "parentCid": 259, "children": [ "41", "114", "158", "96", "95", "99" ] }, "29": { "parentCid": 259, "children": [ "78", "121", "142", "100", "50", "241", "116", "120" ] }, "30": { "parentCid": 257, "children": [ "230" ] }, "31": { "parentCid": 257, "children": [ "209", "234" ] }, "36": { "parentCid": 5, "children": [] }, "37": { "parentCid": 135, "children": [] }, "40": { "parentCid": 134, "children": [ "216" ] }, "41": { "parentCid": 28, "children": [ "184", "186", "188", "189" ] }, "49": { "parentCid": 11, "children": [] }, "50": { "parentCid": 29, "children": [] }, "52": { "parentCid": 135, "children": [ "155", "156", "157" ] }, "53": { "parentCid": 134, "children": [] }, "69": { "parentCid": 27, "children": [ "152" ] }, "71": { "parentCid": 0, "children": [] }, "73": { "parentCid": 135, "children": [ "220", "221", "222" ] }, "74": { "parentCid": 27, "children": [ "213", "214", "215", "261", "260", "262", "283" ] }, "75": { "parentCid": 134, "children": [] }, "77": { "parentCid": 134, "children": [] }, "78": { "parentCid": 29, "children": [ "176" ] }, "79": { "parentCid": 134, "children": [] }, "81": { "parentCid": 135, "children": [ "180", "181", "182", "183" ] }, "82": { "parentCid": 134, "children": [] }, "85": { "parentCid": 27, "children": [ "277", "278" ] }, "89": { "parentCid": 134, "children": [] }, "91": { "parentCid": "26", "children": [] }, "94": { "parentCid": 134, "children": [] }, "95": { "parentCid": 28, "children": [ "168", "169", "170" ] }, "96": { "parentCid": 28, "children": [ "151" ] }, "99": { "parentCid": 28, "children": [] }, "100": { "parentCid": 29, "children": [ "172" ] }, "104": { "parentCid": 135, "children": [ "224", "226", "227" ] }, "107": { "parentCid": 135, "children": [ "205", "206", "207" ] }, "110": { "parentCid": 135, "children": [ "272", "273" ] }, "114": { "parentCid": 28, "children": [ "143", "145" ] }, "116": { "parentCid": 29, "children": [] }, "120": { "parentCid": 29, "children": [ "287" ] }, "121": { "parentCid": 29, "children": [] }, "132": { "parentCid": "8", "children": [] }, "134": { "parentCid": "5", "children": [ "40", "210", "77", "94", "149", "280", "82", "53", "240", "275", "243", "75", "255", "89", "79", "139", "197" ] }, "135": { "parentCid": "5", "children": [ "73", "52", "37", "237", "177", "163", "236", "166", "107", "137", "81", "288", "110", "238", "104", "173", "138" ] }, "137": { "parentCid": "135", "children": [] }, "138": { "parentCid": 135, "children": [ "147", "148" ] }, "139": { "parentCid": "134", "children": [] }, "140": { "parentCid": "2", "children": [] }, "141": { "parentCid": "2", "children": [] }, "142": { "parentCid": 29, "children": [ "282" ] }, "143": { "parentCid": "114", "children": [ "144" ] }, "144": { "parentCid": "143", "children": [] }, "145": { "parentCid": "114", "children": [ "146" ] }, "146": { "parentCid": "145", "children": [] }, "147": { "parentCid": "138", "children": [] }, "148": { "parentCid": "138", "children": [] }, "149": { "parentCid": "134", "children": [ "150" ] }, "150": { "parentCid": "149", "children": [] }, "151": { "parentCid": "96", "children": [] }, "152": { "parentCid": "69", "children": [ "154", "286", "153" ] }, "153": { "parentCid": 152, "children": [] }, "154": { "parentCid": 152, "children": [] }, "155": { "parentCid": "52", "children": [] }, "156": { "parentCid": "52", "children": [] }, "157": { "parentCid": "52", "children": [] }, "158": { "parentCid": "28", "children": [ "159", "160", "162" ] }, "159": { "parentCid": "158", "children": [] }, "160": { "parentCid": "158", "children": [ "161" ] }, "161": { "parentCid": "160", "children": [] }, "162": { "parentCid": "158", "children": [] }, "163": { "parentCid": "135", "children": [ "164", "165", "218" ] }, "164": { "parentCid": "163", "children": [] }, "165": { "parentCid": "163", "children": [] }, "166": { "parentCid": "135", "children": [ "167" ] }, "167": { "parentCid": "166", "children": [] }, "168": { "parentCid": "95", "children": [] }, "169": { "parentCid": "95", "children": [] }, "170": { "parentCid": "95", "children": [] }, "172": { "parentCid": "100", "children": [] }, "173": { "parentCid": "135", "children": [ "174", "175", "217", "284" ] }, "174": { "parentCid": "173", "children": [] }, "175": { "parentCid": "173", "children": [] }, "176": { "parentCid": "78", "children": [] }, "177": { "parentCid": "135", "children": [ "178", "179" ] }, "178": { "parentCid": "177", "children": [] }, "179": { "parentCid": "177", "children": [] }, "180": { "parentCid": "81", "children": [] }, "181": { "parentCid": "81", "children": [] }, "182": { "parentCid": "81", "children": [] }, "183": { "parentCid": "81", "children": [] }, "184": { "parentCid": "41", "children": [ "185" ] }, "185": { "parentCid": 184, "children": [] }, "186": { "parentCid": "41", "children": [ "187" ] }, "187": { "parentCid": 186, "children": [] }, "188": { "parentCid": "41", "children": [] }, "189": { "parentCid": "41", "children": [] }, "190": { "parentCid": "2", "children": [] }, "191": { "parentCid": "26", "children": [ "192" ] }, "192": { "parentCid": "191", "children": [] }, "193": { "parentCid": "26", "children": [ "194" ] }, "194": { "parentCid": "193", "children": [] }, "195": { "parentCid": "26", "children": [ "196" ] }, "196": { "parentCid": "195", "children": [] }, "197": { "parentCid": "134", "children": [] }, "198": { "parentCid": "5", "children": [ "199", "200", "201" ] }, "199": { "parentCid": "198", "children": [] }, "200": { "parentCid": "198", "children": [] }, "201": { "parentCid": "198", "children": [] }, "202": { "parentCid": "27", "children": [ "203", "204" ] }, "203": { "parentCid": "202", "children": [] }, "204": { "parentCid": "202", "children": [] }, "205": { "parentCid": "107", "children": [] }, "206": { "parentCid": "107", "children": [] }, "207": { "parentCid": "107", "children": [] }, "208": { "parentCid": "23", "children": [] }, "209": { "parentCid": "31", "children": [] }, "210": { "parentCid": "134", "children": [ "211" ] }, "211": { "parentCid": "210", "children": [] }, "213": { "parentCid": "74", "children": [] }, "214": { "parentCid": "74", "children": [] }, "215": { "parentCid": "74", "children": [] }, "216": { "parentCid": "40", "children": [] }, "217": { "parentCid": "173", "children": [] }, "218": { "parentCid": "163", "children": [] }, "219": { "parentCid": "21", "children": [] }, "220": { "parentCid": "73", "children": [] }, "221": { "parentCid": "73", "children": [] }, "222": { "parentCid": "73", "children": [] }, "223": { "parentCid": "21", "children": [] }, "224": { "parentCid": "104", "children": [ "225" ] }, "225": { "parentCid": "224", "children": [] }, "226": { "parentCid": "104", "children": [] }, "227": { "parentCid": "104", "children": [] }, "228": { "parentCid": 0, "children": [] }, "229": { "parentCid": 23, "children": [] }, "230": { "parentCid": 30, "children": [] }, "231": { "parentCid": "8", "children": [] }, "232": { "parentCid": "8", "children": [] }, "233": { "parentCid": 0, "children": [] }, "234": { "parentCid": 31, "children": [] }, "235": { "parentCid": 0, "children": [] }, "236": { "parentCid": 135, "children": [ "274" ] }, "237": { "parentCid": 135, "children": [] }, "238": { "parentCid": 135, "children": [ "239", "270" ] }, "239": { "parentCid": 238, "children": [] }, "240": { "parentCid": 134, "children": [ "271" ] }, "241": { "parentCid": 29, "children": [] }, "242": { "parentCid": 0, "children": [] }, "243": { "parentCid": 134, "children": [] }, "244": { "parentCid": 256, "children": [ "245" ] }, "245": { "parentCid": "244", "children": [] }, "246": { "parentCid": 257, "children": [] }, "250": { "parentCid": 258, "children": [ "251", "252", "253", "254" ] }, "251": { "parentCid": 250, "children": [] }, "252": { "parentCid": "250", "children": [] }, "253": { "parentCid": "250", "children": [] }, "254": { "parentCid": "250", "children": [] }, "255": { "parentCid": "134", "children": [] }, "256": { "parentCid": "5", "children": [ "244", "263" ] }, "257": { "parentCid": 0, "children": [ "246", "30", "31" ] }, "258": { "parentCid": 0, "children": [ "26", "250" ] }, "259": { "parentCid": 0, "children": [ "28", "29" ] }, "260": { "parentCid": "74", "children": [] }, "261": { "parentCid": "74", "children": [] }, "262": { "parentCid": "74", "children": [] }, "263": { "parentCid": 256, "children": [ "279", "269" ] }, "264": { "parentCid": "22", "children": [] }, "265": { "parentCid": "22", "children": [] }, "266": { "parentCid": "27", "children": [] }, "267": { "parentCid": "27", "children": [] }, "268": { "parentCid": "27", "children": [] }, "269": { "parentCid": "263", "children": [] }, "270": { "parentCid": "238", "children": [] }, "271": { "parentCid": "240", "children": [] }, "272": { "parentCid": "110", "children": [] }, "273": { "parentCid": "110", "children": [] }, "274": { "parentCid": 236, "children": [] }, "275": { "parentCid": 134, "children": [] }, "276": { "parentCid": "27", "children": [] }, "277": { "parentCid": "85", "children": [] }, "278": { "parentCid": "85", "children": [] }, "279": { "parentCid": "263", "children": [] }, "280": { "parentCid": 134, "children": [] }, "281": { "parentCid": "1", "children": [] }, "282": { "parentCid": "142", "children": [] }, "283": { "parentCid": "74", "children": [] }, "284": { "parentCid": "173", "children": [ "285" ] }, "285": { "parentCid": "284", "children": [] }, "286": { "parentCid": "152", "children": [] }, "287": { "parentCid": "120", "children": [] }, "288": { "parentCid": "135", "children": [ "289", "290" ] }, "289": { "parentCid": "288", "children": [] }, "290": { "parentCid": "288", "children": [] } }
-
Maximum kudos to @baris who has fixed this (for anyone else wondering).
fix: clear children before building tree · NodeBB/NodeBB@397e062
Node.js based forum software built for the modern web - fix: clear children before building tree · NodeBB/NodeBB@397e062
GitHub (github.com)