Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

await pusher.get() returning unresolved promise #832

Open
nizamani opened this issue Jul 15, 2024 · 0 comments
Open

await pusher.get() returning unresolved promise #832

nizamani opened this issue Jul 15, 2024 · 0 comments

Comments

@nizamani
Copy link

nizamani commented Jul 15, 2024

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant