Open
Description
I ran into this error while framing a large JSON-LD file:
/home/runner/work/garance/garance/node_modules/jsonld/lib/frame.js:76
api.frame = (state, subjects, frame, parent, property = null) => {
^
RangeError: Maximum call stack size exceeded
at api.frame (/home/runner/work/garance/garance/node_modules/jsonld/lib/frame.js:76:13)
at api.frame (/home/runner/work/garance/garance/node_modules/jsonld/lib/frame.js:258:15)
at api.frame (/home/runner/work/garance/garance/node_modules/jsonld/lib/frame.js:258:15)
at api.frame (/home/runner/work/garance/garance/node_modules/jsonld/lib/frame.js:258:15)
at api.frame (/home/runner/work/garance/garance/node_modules/jsonld/lib/frame.js:258:15)
at api.frame (/home/runner/work/garance/garance/node_modules/jsonld/lib/frame.js:258:15)
at api.frame (/home/runner/work/garance/garance/node_modules/jsonld/lib/frame.js:258:15)
at api.frame (/home/runner/work/garance/garance/node_modules/jsonld/lib/frame.js:258:15)
at api.frame (/home/runner/work/garance/garance/node_modules/jsonld/lib/frame.js:258:15)
at api.frame (/home/runner/work/garance/garance/node_modules/jsonld/lib/frame.js:258:15)
Seems like this is induced by some kind of recursive call in the framing algorithm, line 258 of frame.js: https://github.com/digitalbazaar/jsonld.js/blob/main/lib/frame.js#L258
I am reading here that using a "setTimeout" every e.g. 1000 recursive calls may provide the engine the chance to clear the stack: https://stackoverflow.com/a/20999077/189723