You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a bit of an odd one, and the issue very may lie somewhere other than this library. But I figured I'd pass this along in case anybody has any ideas.
If I run the following Node.js script (TypeScript with ES module interop enabled):
import stringify from "safe-stable-stringify";
import fetch from "node-fetch";
process.on("warning", warning => {
console.log("Received a warning event from Node.js", warning.name);
const w = stringify(warning);
// Just reference this so that the compiler doesn't filter out the unused import, which I suspect has side effects
const f = fetch;
});
// Trigger a warning to invoke the above logging
for (let i = 0; i < 200; i++) {
process.on("warning", () => {});
}
here is the output I get:
(node:172053) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 warning listeners added to [process]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
Received a warning event from Node.js MaxListenersExceededWarning
TypeError: Method get TypedArray.prototype.length called on incompatible receiver [object Object]
at get length [as length] (<anonymous>)
at Uint8Array.toJSON (node:buffer:1141:12)
at stringifySimple (/workspaces/obsidian/node_modules/safe-stable-stringify/index.js:509:25)
at stringifySimple (/workspaces/obsidian/node_modules/safe-stable-stringify/index.js:572:23)
at stringifySimple (/workspaces/obsidian/node_modules/safe-stable-stringify/index.js:572:23)
at stringifySimple (/workspaces/obsidian/node_modules/safe-stable-stringify/index.js:572:23)
at stringifySimple (/workspaces/obsidian/node_modules/safe-stable-stringify/index.js:536:25)
at stringifySimple (/workspaces/obsidian/node_modules/safe-stable-stringify/index.js:572:23)
at stringifySimple (/workspaces/obsidian/node_modules/safe-stable-stringify/index.js:540:23)
at stringifySimple (/workspaces/obsidian/node_modules/safe-stable-stringify/index.js:572:23)
If I remove any references to node-fetch, the script works as expected:
(node:172353) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 warning listeners added to [process]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
Received a warning event from Node.js MaxListenersExceededWarning
It seems that importing node-fetch is doing something that interferes with safe-stable-stringify.
Versions:
safe-stable-stringify: 2.5.0
node-fetch: 2.6.7 (unfortunately we are not yet on ESM and can't use v3)
The text was updated successfully, but these errors were encountered:
Hi,
This is a bit of an odd one, and the issue very may lie somewhere other than this library. But I figured I'd pass this along in case anybody has any ideas.
If I run the following Node.js script (TypeScript with ES module interop enabled):
here is the output I get:
If I remove any references to
node-fetch
, the script works as expected:It seems that importing
node-fetch
is doing something that interferes withsafe-stable-stringify
.Versions:
safe-stable-stringify
: 2.5.0node-fetch
: 2.6.7 (unfortunately we are not yet on ESM and can't use v3)The text was updated successfully, but these errors were encountered: