DeepSpaceHarbor / hexo-bridge

Command center for websites powered by hexo.
GNU General Public License v3.0
32 stars 6 forks source link

RangeError: Maximum call stack size exceeded #181

Closed neverbot closed 1 year ago

neverbot commented 1 year ago

Using hexo-bridge, this happens when I go to the posts page (I can view the pages, files, themes, etc just right). I don't have stats now, but there are a lot of posts, probably >1000, just in case it could be related.

Any ideas?

Screenshot 2023-04-14 at 00 05 58

RangeError: Maximum call stack size exceeded
    at String.replace (<anonymous>)
    at escapeRegExp (/<path>/web/node_modules/hexo-util/lib/escape_regexp.js:7:14)
    at slugize (/<path>/web/node_modules/hexo-util/lib/slugize.js:13:22)
    at _Document.<anonymous> (/<path>/web/node_modules/hexo/lib/models/tag.js:21:12)
    at _Document.slug (/<path>/web/node_modules/warehouse/lib/types/virtual.js:59:24)
    at JSON.stringify (<anonymous>)
    at toJson (/<path>/web/node_modules/hexo-bridge/utils.js:18:15)
    at ServerResponse.res.sendSuccess (/<path>/web/node_modules/hexo-bridge/index.js:17:13)
    at /<path>/web/node_modules/hexo-bridge/index.js:48:9
    at call (/<path>/web/node_modules/connect/index.js:239:7)
    at next (/<path>/web/node_modules/connect/index.js:183:5)
    at next (/<path>/web/node_modules/connect/index.js:161:14)
    at next (/<path>/web/node_modules/connect/index.js:161:14)
    at next (/<path>/web/node_modules/connect/index.js:161:14)
    at setupHelpers (/<path>/web/node_modules/hexo-bridge/index.js:23:3)
    at call (/<path>/web/node_modules/connect/index.js:239:7)

Every time I reload the Maximum call stack size exceeded happens in a different point in the call stack, usually some regexp or some operation with Moment.

neverbot commented 1 year ago

Update: similar problem when I try to create a new post:

RangeError: Maximum call stack size exceeded
    at _Document.<anonymous> (/<path>/web/node_modules/hexo/lib/models/tag.js:38:25)
    at _Document.posts (/<path>/web/node_modules/warehouse/lib/types/virtual.js:59:24)
    at JSON.stringify (<anonymous>)
    at toJson (/<path>/web/node_modules/hexo-bridge/utils.js:18:15)
    at ServerResponse.res.sendSuccess (/<path>/web/node_modules/hexo-bridge/index.js:17:13)
    at /<path>/web/node_modules/hexo-bridge/index.js:104:11

The markdown file for the new post has been created, but I am not redirected to any editor, and as I said before, I cannot view it on the posts.

DeepSpaceHarbor commented 1 year ago

Hey, I'm sorry for the late reply.

Do you have a sample code/blog I can download to test? Based on the logs, it seems like the code for removing circular object references is failing, and it would be easier for me to test the new code if I already have a failing test case.

neverbot commented 1 year ago

Hi! Yes, in fact the web i was trying to use the plugin with is fully open-sourced, it's here: https://github.com/neverbot/neverbot.com. Thanks in advance!

DeepSpaceHarbor commented 1 year ago

Thanks for sharing! I was able to replicate and fix the bug. If you upgrade to the latest 1.2.0 version of hexo-bridge, it should work as expected.

image

neverbot commented 1 year ago

Can confirm it works, thanks a lot! :)