"ipfs-core": "0.3.0"
Platform:
Darwin MBP 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64
Subsystem:
ipfs-core pubsub
High
Setting the timeout option when calling pubsub subscribe throws an error.
In ipfs and ipfs-http-client this works fine, but it seems that ipfs-core should also be able to handle it as long as pubsub is enabled but it doesn't.
https://github.com/ipfs/js-ipfs/blob/master/packages/ipfs-core/src/components/pubsub.js#L17
// core.js
const IPFS = require('ipfs-core')
const topic = '/ceramic/testnet-clay'
const ipfsConfig = {
config: {
Pubsub: {
Enabled: true
}
}
}
const run = async () => {
const ipfs = await IPFS.create(ipfsConfig)
ipfs.pubsub.subscribe(topic, console.log, { timeout: 2000 })
.then(() => {
console.log('subscribe success')
})
.catch((err) => {
console.error('subscribe failure', err.message)
})
}
run()
(node:13853) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'Symbol(Symbol.asyncIterator)' of undefined
at Object.subscribe (/test-ceramic-connect/node_modules/ipfs-core-utils/src/with-timeout-option.js:56:14)
at run (/test-ceramic-connect/core.js:15:15)
(node:13853) 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: 4)
(node:13853) [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.
(node:13853) UnhandledPromiseRejectionWarning: TimeoutError: request timed out
at AbortSignal.<anonymous> (/test-ceramic-connect/node_modules/ipfs-core-utils/src/with-timeout-option.js:34:16)
at AbortSignal.dispatchEvent (/test-ceramic-connect/node_modules/event-target-shim/dist/event-target-shim.js:818:35)
at abortSignal (/test-ceramic-connect/node_modules/abort-controller/dist/abort-controller.js:52:12)
at AbortController.abort (/test-ceramic-connect/node_modules/abort-controller/dist/abort-controller.js:91:9)
at AbortController.abort (/test-ceramic-connect/node_modules/timeout-abort-controller/index.js:30:18)
at /Users/val/Code/test-ceramic-connect/node_modules/timeout-abort-controller/index.js:20:38
at Timeout.timerWrapper (/test-ceramic-connect/node_modules/retimer/retimer.js:21:16)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
(node:13853) 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: 5)
Please upgrade to [email protected] - I can replicate this error with [email protected] but it does not occur for me with [email protected].
Also pubsub has been enabled by default in js-IPFS since late 2019 so there's no need to pass config.Pubsub.Enabled = true any more 馃帀 .
Thanks @achingbrain will test again with 0.3.1