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

Description

@negamaxi
  • 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)
      }
    })
  })

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugA bug in existing code (including security flaws)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions