Bug: Stream disconnects and fails to reconnect
agardez opened this issue Β· comments
Describe the bug
When opening a stream with await xmtp.conversations.stream()
it ends up disconnecting after a few minutes, unable to reconnect due to an error:
Stream connection closed. Resubscribing TypeError: fetch failed
Expected behavior
The stream should reconnect automatically
Steps to reproduce the bug
Build a simple nodes app with the following
const xmtp = await Client.create(null, { privateKeyOverride: keysUint8Array, env: 'production' });
stream = await xmtp.conversations.stream()
Then leave that app running for a few minutes and you'll receive the error message.
Would be helpful to get some more information about the environment you are running in. What's the node version and XMTP SDK version?
FWIW, it is possible that the connection is timing out but that it is reconnecting successfully. We only log messages on connection failures, but not on successful reconnects.
Hey @neekolas thanks for your response. As it turns out, yes it is actually reconnecting successfully, despite printing this message.
So there's no real bug here, rather a confusing log showing up in the console.
I'm using xmtp-js v9.3.1, with node 20.4.0.
We should at the very least change the logging. It is very confusing to see those errors and no sign things have resolved.
We also should investigate why you are getting disconnections at all from Node.JS. That doesn't have any sort of client-side timeout, so connections should last for 2 hours (the max our load balancers will allow).
I agree. If that's of any help, this happens both by running locally on a MacOS 13.4.1, and on Heroku.
π This issue has been resolved in version 11.2.2 π
The release is available on:
Your semantic-release bot π¦π
π This issue has been resolved in version 11.3.0-beta.13 π
The release is available on:
Your semantic-release bot π¦π