Skip to content
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

libp2p:gossipsub:error createOutboundStream error TypeError: fns.shift(...) is not a function #305

Closed
D4nte opened this issue Jul 21, 2022 · 5 comments

Comments

@D4nte
Copy link
Contributor

D4nte commented Jul 21, 2022

Getting this error message with @chainsafe/libp2p-gossipsub@3.3.0:

  libp2p:gossipsub:error createOutboundStream error TypeError: fns.shift(...) is not a function
    at rawPipe (file:///home/fryorcraken/src/status-im/js-waku/node_modules/it-pipe/src/index.ts:8:22)
    at pipe (file:///home/fryorcraken/src/status-im/js-waku/node_modules/it-pipe/src/index.ts:167:10)
    at new OutboundStream (file:///home/fryorcraken/src/status-im/js-waku/node_modules/@chainsafe/libp2p-gossipsub/src/stream.ts:22:3)
    at EventTarget.createOutboundStream (file:///home/fryorcraken/src/status-im/js-waku/node_modules/@chainsafe/libp2p-gossipsub/src/index.ts:681:16)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async file:///home/fryorcraken/src/status-im/js-waku/node_modules/@chainsafe/libp2p-gossipsub/src/index.ts:486:9 +0ms

The issue is because the rawStream passed is not a function:

const stream = new OutboundStream(await connection.newStream(this.multicodecs), (e) =>

Will try to investigate more later.

@D4nte
Copy link
Contributor Author

D4nte commented Jul 21, 2022

I think it might be an issue with libp2p/mplex, will open issue on their repo

@D4nte
Copy link
Contributor Author

D4nte commented Jul 22, 2022

I seemed to have fixed the issue locally by replacing

this.rawStream = rawStream

With this.rawStream = rawStream.stream. Because rawStream actually is:

{
  stream: {
    close: [Function: close],
    closeRead: [Function: closeRead],
    closeWrite: [Function: closeWrite],
    abort: [Function: abort],
    reset: [Function: reset],
    sink: [AsyncFunction: sink],
    source: Object [AsyncGenerator] {},
    stat: { direction: 'outbound', timeline: [Object] },
    metadata: {},
    id: 'i2'
  },
  protocol: '/vac/waku/relay/2.0.0-beta2'
}

I know that the move of the protocol is a recent interface change, need to find the culprit

@wemeetagain
Copy link
Member

Maybe due to the version of js-libp2p you're using?
Should have this integrated or else https://github.com/libp2p/js-libp2p/pull/1255/files

@D4nte
Copy link
Contributor Author

D4nte commented Jul 22, 2022

Yes so the issue is that libp2p brings an old version of @libp2p/connection that implements the old API:

js-waku@0.24.0 /home/fryorcraken/src/status-im/js-waku
└─┬ libp2p@0.37.3
  └── @libp2p/connection@2.0.4

Indeed this change libp2p/js-libp2p#1255 (files) fixes it.

@wemeetagain
Copy link
Member

closing this since this specific issue is resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants