noiseStream.setKeepAlive is not a function with (Hypercore@^10.0.0-alpha.26)
Nuhvi opened this issue · 8 comments
Replicating Hypercore over a websocket relay (node or browser) fails in the case of using hypercore@^10.0.0-alpha.26
probably because the new protomux
?:
(node:83045) UnhandledPromiseRejectionWarning: TypeError: noiseStream.setKeepAlive is not a function
at Function.createProtocolStream (/media/ward/two/code/play/test-dht-relay-replicate/node_modules/hypercore/index.js:125:21)
at Hypercore.replicate (/media/ward/two/code/play/test-dht-relay-replicate/node_modules/hypercore/index.js:324:38)
at Hyperswarm.<anonymous> (/media/ward/two/code/play/test-dht-relay-replicate/replicate.js:35:10)
at Hyperswarm.emit (events.js:315:20)
at Stream.<anonymous> (/media/ward/two/code/play/test-dht-relay-replicate/node_modules/hyperswarm/index.js:158:12)
at Stream.emit (events.js:327:22)
at ReadableState.afterOpen (/media/ward/two/code/play/test-dht-relay-replicate/node_modules/streamx/index.js:495:12)
at Stream._open (/media/ward/two/code/play/test-dht-relay-replicate/node_modules/@hyperswarm/dht-relay/lib/stream.js:44:7)
at Stream._continueOpen (/media/ward/two/code/play/test-dht-relay-replicate/node_modules/@hyperswarm/dht-relay/lib/stream.js:56:17)
at Stream.onOpen (/media/ward/two/code/play/test-dht-relay-replicate/node_modules/@hyperswarm/dht-relay/lib/stream.js:118:8)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:83045) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:83045) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I made sure to test up to the latest working version hypercore@10.0.0-alpha.25
and it seems to work even with the latest versions of this package:
Nuhvi/test-hypercore-dht-relay@2c9823b
packages used:
"@hyperswarm/dht": "^5.0.17",
"@hyperswarm/dht-relay": "^0.2.1",
"b4a": "^1.3.1",
"hypercore": "10.0.0-alpha.25",
"isomorphic-ws": "^4.0.1",
"random-access-memory": "^4.0.0"
Notice, Hyperswarm will throw an error in browser because of Buffer.equals, so you will have to manually change it in node_modules to use b4a
Did you update your deps? That method is in the latest minor bump of secret-stream which this module tracks.
Is there a pr we are missing for the Buffer.equals?
Is there a pr we are missing for the Buffer.equals?
I meant this holepunchto/hyperswarm#98
to solve these:
https://github.com/hyperswarm/hyperswarm/blob/master/index.js#L181
https://github.com/hyperswarm/hyperswarm/blob/master/index.js#L231
Did you update your deps? That method is in the latest minor bump of secret-stream which this module tracks.
I made sure to update everything, but the moment I go higher than hypercore@10.0.0-alpha.25
I get the same error.
latest test, just now:
"dependencies": {
"@hyperswarm/dht": "^5.0.17",
"@hyperswarm/dht-relay": "^0.2.1",
"b4a": "^1.3.1",
"hypercore": "^10.0.0-alpha.28",
"isomorphic-ws": "^4.0.1",
"random-access-memory": "^4.0.0"
}
The relay is currently missing the changes introduced in holepunchto/hyperswarm-secret-stream#10 and holepunchto/hyperswarm-secret-stream#11. I'll add them ASAP.
Ah sorry, my bad
No worries! Fixed in e1b2440. I'm wondering if it would make sense to abstract common stream functionality like timeout and keep alive to avoid having to duplicate it for the relayed streams?
Yea totally, forgot we were "mirroring" it here.