Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

ipfs.swarm.connect() throws ERR_INVALID_ARG_TYPE in v0.61.0 #3998

Closed
christroutner opened this issue Dec 29, 2021 · 2 comments
Closed

ipfs.swarm.connect() throws ERR_INVALID_ARG_TYPE in v0.61.0 #3998

christroutner opened this issue Dec 29, 2021 · 2 comments
Assignees
Labels
kind/maybe-in-helia need/maintainer-input Needs input from the current maintainer(s)

Comments

@christroutner
Copy link

christroutner commented Dec 29, 2021

  • Version:

I tried a range of versions with different results:

  • 0.60.0 works

  • 0.61.0 broken

  • 0.61.1-rc.2 broken

  • Platform:

  • Ubuntu 20.04

  • Linux trout-dev 5.11.0-34-generic # 36~20.04.1-Ubuntu SMP Fri Aug 27 08:06:32 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

  • Subsystem:

  • Node.js v14.18.2
  • npm v8.3.0

Severity:

  • Critical: This bug effects the swarm.connect() method, so it impacts the nodes ability to connect to other nodes.

Description:

I was testing the latest version of js-ipfs in ipfs-coord when I ran across this issue. v0.60.0 works fine, but v0.61.0 breaks, when making this call:

ipfs.swarm.connect(ipfsAddr)

Here is the error that is thrown:

IPFS and the coordination library is ready.
status: Error trying to connect to peer node /ip4/192.168.2.4/tcp/4002/p2p/12D3KooWFb8eLpLAJmTk1Cm2EgyGCRwscHES5aLABUQMM8Bz1iCK
TypeError [ERR_INVALID_ARG_TYPE]: The "eventTargets" argument must be an instance of EventEmitter or EventTarget. Received an instance of AbortSignal
    at new NodeError (internal/errors.js:322:7)
    at EventEmitter.setMaxListeners (events.js:193:17)
    at Dialer._createPendingDial (/home/trout/work/psf/code/ipfs-coord/node_modules/ipfs-core/node_modules/libp2p/src/dialer/index.js:262:24)
    at Dialer.connectToPeer (/home/trout/work/psf/code/ipfs-coord/node_modules/ipfs-core/node_modules/libp2p/src/dialer/index.js:136:71)
    at async Libp2p._dial (/home/trout/work/psf/code/ipfs-coord/node_modules/ipfs-core/node_modules/libp2p/src/index.js:500:20)
    at async connect (/home/trout/work/psf/code/ipfs-coord/node_modules/ipfs-core/cjs/src/components/swarm/connect.js:10:5)
    at async /home/trout/work/psf/code/ipfs-coord/node_modules/ipfs-core-utils/cjs/src/with-timeout-option.js:70:21
    at async IpfsAdapter.connectToPeer (/home/trout/work/psf/code/ipfs-coord/lib/adapters/ipfs-adapter.js:75:7)
    at async RelayUseCases.initializeRelays (/home/trout/work/psf/code/ipfs-coord/lib/use-cases/relay-use-cases.js:45:34)
    at async IpfsCoord._initializeConnections (/home/trout/work/psf/code/ipfs-coord/index.js:108:7) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Even trying to connect to another node running the same version (v0.61.0) fails.

Steps to reproduce the error:

  • Install js-ipfs v0.60.0
  • Make a call to ipfs.swarm.connect(ipfsAddr) notice that is succeeds.
  • Wipe the node_modules folder and install js-ipfs v0.61.0
  • Make a call to ipfs.swarm.connect(ipfsAddr) notice it throws ERR_INVALID_ARG_TYPE
@SgtPooki
Copy link
Member

js-ipfs is being deprecated in favor of Helia. You can #4336 and read the migration guide.

Please feel to reopen with any comments by 2023-06-02. We will do a final pass on reopened issues afterward (see #4336).

Assigning to @achingbrain to answer whether this issue is already resolved in Helia, or if this issue needs to be migrated to that repo!

@SgtPooki SgtPooki added need/maintainer-input Needs input from the current maintainer(s) kind/maybe-in-helia and removed need/triage Needs initial labeling and prioritization labels May 26, 2023
@achingbrain
Copy link
Member

I think this problem is caused by using an out of date node.js version, please upgrade to node 18.

Otherwise please port your app to use Helia - it ships with the latest and greatest libp2p which is where this error is coming from.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/maybe-in-helia need/maintainer-input Needs input from the current maintainer(s)
Projects
No open projects
Status: Done
Development

No branches or pull requests

3 participants