threefoldtech / tfchain_graphql

Graphql for TFchain
Apache License 2.0
2 stars 3 forks source link

Bug: node-fetch used by squid-sdk/util/util-internal-http-client is not compatible with node 20 #183

Open sameh-farouk opened 4 months ago

sameh-farouk commented 4 months ago

This error was noticed, but it seems not critical (Affecting the log module only), and the processor is functioning without noticeable issues.

{"ns":"sys","time":1717715452573,"level":4,"msg":"Failed to serialize log record from sqd:processor:archive-request","err":{"stack":"TypeError [ERR_INVALID_THIS]: Value of \"this\" must be of type URLSearchParams\n    at get size (node:internal/url:459:13)\n    at Reflect.get (<anonymous>)\n    at Object.get (file:///squid/node_modules/@subsquid/util-internal-http-client/node_modules/node-fetch/src/headers.js:143:22)\n    at toJsonObject (/squid/node_modules/@subsquid/util-internal-json/lib/json.js:63:33)\n    at toJSON (/squid/node_modules/@subsquid/util-internal-json/lib/json.js:46:24)\n    at toJsonObject (/squid/node_modules/@subsquid/util-internal-json/lib/json.js:63:23)\n    at toJSON (/squid/node_modules/@subsquid/util-internal-json/lib/json.js:46:24)\n    at stringify (/squid/node_modules/@subsquid/logger/lib/sinks/json.js:12:52)\n    at Logger.jsonLinesStderrSink [as sink] (/squid/node_modules/@subsquid/logger/lib/sinks/json.js:7:26)\n    at Logger.write (/squid/node_modules/@subsquid/logger/lib/logger.js:56:14)"}}

The original issue seems to be thrown by node-fetch. squid-sdk firesquid release uses a version that is not compatible with node 20. firesquid uses node 16.

We recently tried to use node 20 which triggered this issue, so reverting to node 18 should make this error in logs gone.