What does this error mean?
Error: 13 INTERNAL: received RST_STREAM with code 0
At the moment, there are three endpoints which aren't working very well and result in an RST_STREAM error which the SDK doesn't handle (even v2.1.1), if you override the SDK's default list of nodes you should be ok.
There is an issue to track this in github already: https://github.com/hashgraph/hedera-sdk-js/issues/622
In the mean time you can handle errors as follows:
With Promise
let retry = true;
while (retry) {
await new AccountBalanceQuery()
.setAccountId(operatorId)
.execute(client)
.then(() => {
retry = false;
console.log("---> SUCCESS");
})
.catch(error => {
console.error(error);
if (error.message.includes('RST_STREAM')) {
console.log("---> RETRY");
}
});
}
}
with try/catch
let retry = true;
while (retry) {
try {
await new AccountBalanceQuery()
.setAccountId(operatorId)
.execute(client);
retry = false;
console.log("---> SUCCESS");
} catch (error) {
console.error(error);
if (error.message.includes('RST_STREAM')) {
console.log("---> RETRY");
}
}
}
That way, if other nodes fail to respond, you'll be dealing with it nicely.