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
Hey y'all. We've used this library with different NodeJS versions, and on the 20 LTS version, kubo-rpc-client throws timeout errors frequently whenever an RPC function is called. You don't have to call a specific function, it throws randomly.
An example code to produce:
import { create, urlSource } from "kubo-rpc-client";
const topicToTest = "test-topic" + Math.random();
(async () => {
const kuboClient = create("http://localhost:5001/api/v0");
let subscriptionCount = 0;
setTimeout(async () => {
const subscribedPubsubTopics = await kuboClient.pubsub.ls();
if (!subscribedPubsubTopics.includes(topicToTest)) {
await kuboClient.pubsub.subscribe(topicToTest, () => {}, {
onError: (err) => console.error(`Failed to pubsub subscribe`, err),
});
subscriptionCount++;
console.log(
`Subscribed to topic (${topicToTest}) for the ${subscriptionCount}th time`
);
}
}, 5000);
})();
Randomly you'd get a timeout error that looks like this
Failed to pubsub subscribe TypeError: terminated
at Fetch.onAborted (node:internal/deps/undici/undici:10917:53)
at Fetch.emit (node:events:518:28)
at Fetch.terminate (node:internal/deps/undici/undici:10102:14)
at Object.onError (node:internal/deps/undici/undici:11035:38)
at _Request.onError (node:internal/deps/undici/undici:7200:31)
at errorRequest (node:internal/deps/undici/undici:9765:17)
at Socket.onSocketClose (node:internal/deps/undici/undici:8927:9)
at Socket.emit (node:events:518:28)
at TCP.<anonymous> (node:net:337:12) {
[cause]: BodyTimeoutError: Body Timeout Error
at Timeout.onParserTimeout [as callback] (node:internal/deps/undici/undici:8855:32)
at Timeout.onTimeout [as _onTimeout] (node:internal/deps/undici/undici:6893:17)
at listOnTimeout (node:internal/timers:573:17)
at process.processTimers (node:internal/timers:514:7) {
code: 'UND_ERR_BODY_TIMEOUT'
}
}
I've tested on Node 20, 18, and 16. 16 Doesn't have this issue, so I guess it's a compatibility problem between kubo-rpc-client and native fetch in node 18+
Hey y'all. We've used this library with different NodeJS versions, and on the 20 LTS version, kubo-rpc-client throws timeout errors frequently whenever an RPC function is called. You don't have to call a specific function, it throws randomly.
An example code to produce:
Randomly you'd get a timeout error that looks like this
Kubo: 0.24.0
kubo-rpc-client: 3.0.4
NodeJS: v20.11.1
The text was updated successfully, but these errors were encountered: