This repository was archived by the owner on Feb 12, 2024. It is now read-only.
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
pubsub.subscribe throws an error when trying to use it promise-way #1137
Closed
Description
- Version: 0.27.0
- Platform: Linux
- Subsystem: x64
Type: Bug
Severity: High
Description: pubsub.subscribe throws an error when trying to use it promise-way. Seems to be related with #1129.
Steps to reproduce the error:
await ipfs.pubsub.subscribe(topic, handleMessage)
// Uncaught TypeError: callback is not a function
Therefore callback-way is the only available for now. Here is simple workaround:
await new Promise((resolve, reject) => {
ipfs.pubsub.subscribe(topic, handleMessage, err => {
if (err) {
reject(err)
} else {
resolve(err)
}
})
})