Skip to content

await pusher.get() returning unresolved promise #832

Closed
@nizamani

Description

@nizamani

Do you want to request a feature or report a bug?

  • I want to report a bug

What is the current behavior?

  • In following code I expect to get list of users who are subscribed to channelName. Variable channelName has name of our presence channel
    const usersList = await pusher.get({ path: /channels/${channelName}/users });
  • Instead of pusher getting list of all users who are currently subscribed to this channel, I get an unresolved promise.
  • I event tried using .then instead of await so consider following code:
    pusher.get({ path:/channels/${channelName}/users}) .then(async (data) => { console.log(await data.json()); }) .catch((error) => { console.log(error); });
  • As you can see in above code, even though I use .then to resolve promise, I still have to await data.json() inside .then() clause

If the current behavior is a bug, please provide the steps to reproduce and
if possible a minimal demo of the problem via https://jsfiddle.net or similar.

  • install pusher library on node server
  • import Pusher class and create Pusher class instance
  • authorize/authenticate users to pusher channel
  • then in separate nodejs endpoint, run following code
    await pusher.get({ path: /channels/${channelName}/users })
    This will return a non-resolved promise

What is the expected behavior?
Expected behavior would be I get an array of list of users. So data should be returned after promise is resolved

Which versions of Pusher, and which browsers / OS are affected by this issue?
Did this work in previous versions of Pusher? If so, which?

  • We have node version v16.18.0 and pusher version 8.19.2
  • I haven't tried this in older version of pusher packages

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions