-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subscribe fails with Error subscribing to peer
#1562
Comments
Thanks for the report! I will look into it along the other one. |
So, for now, adding error handling for that case to see what actually breaks. @agazso could you share a minimal repro setup, please? Once I understand I can add unit test for that case. |
I accidentally found a minimal reproduction by using If the import { Protocols } from "@waku/interfaces"
import { createDecoder, createLightNode, waitForRemotePeer } from "@waku/sdk"
import { multiaddr } from '@multiformats/multiaddr'
// change the id of the peer
const peerMultiaddr = multiaddr(
'/ip4/127.0.0.1/tcp/8000/ws/p2p/16Uiu2HAm53sojJN72rFbYg6GV2LpRRER9XeWkiEAhjKy3aL9cN5Z',
)
main()
async function main() {
const waku = await createLightNode()
await waku.start()
await waku.dial(peerMultiaddr)
await waitForRemotePeer(waku, [Protocols.Filter, Protocols.LightPush, Protocols.Store])
const messageDecoder = createDecoder('abc')
const unsubscribe = await waku.filter.subscribe([messageDecoder], () => { /* */ })
await unsubscribe()
await waku.stop()
} |
My guess now is that recent changes fix the problem and currently it fails on |
This is a bug report
Problem
I have an app and it subscribes to several topics when it starts. It usually works but sometimes it returns with this error:
(See full stack trace below). I am not sure how to deal with this. There were four subscriptions and three other
subscribe
calls were successful. I also print out the waku connection status and it was reported as connected at the time of the call, but 200 milliseconds later it got disconnected (as in it gotpeer:disconnected
event fromlibp2p
andlibp2p.getConnections().length === 0
).Proposed Solutions
I think it would be better if the library checked for the value before trying to call
slice
on it. And if it is undefined then throw an exception which describes what happened or at least the documentation could include it along with some instructions what to do in that case (for example repeat thesubscribe
call or something).Notes
@waku/sdk
version 0.0.18Running on Node v18.17 on Linux
Connected to nwaku 0.18
Full stack trace:
The text was updated successfully, but these errors were encountered: