ipfs / helia

An implementation of IPFS in JavaScript
https://helia.io
Other
835 stars 82 forks source link

`helia.libp2p.onDiscoveryPeer` fails with `Uncaught TypeError: Cannot read properties of undefined (reading 'id')` #52

Closed SgtPooki closed 1 year ago

SgtPooki commented 1 year ago

I'm trying to implement some ipfs-examples/helia-examples (part of https://github.com/ipfs/helia/issues/43) and I was trying to debug peer connections by listening to events using onDiscoveryPeer and it's failing with the error Uncaught TypeError: Cannot read properties of undefined (reading 'id')

SgtPooki commented 1 year ago

This should probably be transferred to the appropriate libp2p repo, but I thought it appropriate to node issues with using helia while it's still being built up

SgtPooki commented 1 year ago

this works though

  helia.libp2p.addEventListener('peer:discovery', (evt) => {
    console.log('Discovered %s', evt.detail.id.toString()) // Log discovered peer
  })
achingbrain commented 1 year ago

Unfortunately I don't think you can transfer issues between orgs. Please can you examine the stack trace to see where the code tries to read the id property and open an issue in the appropriate repo.