question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

got undefined error on pusher:subscription_error event.

See original GitHub issue

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

bug

What is the current behavior?

got undefined error on pusher:subscription_error event.

pusher:subscription_error { type: 'AuthError', error: undefined } undefined

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.

const pusher = new Pusher(env.PUSHER_APP_KEY, {
  cluster: env.PUSHER_APP_CLUSTER,
  authEndpoint: 'https://my-server/channels/auth',
  auth: {
    headers: {
      'Authorization': 'Bearer token',
    },
  },
});

  const channelName = 'presence-agents';
  const channel = await pusher.subscribe(channelName);
  console.log('subscribed channel', channelName);

  channel.bind('pusher:subscription_error', (error, data) => {
    console.error('pusher:subscription_error', error, data);
  });

What is the expected behavior?

the error param should not be undefined.

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

pusher-js: 7.0.0 node: v12.16.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
chenghungcommented, Aug 6, 2020

@leesio thanks for reply,

I’m using pusher-js package in a node environment so there is no browser network data to show.

you can reproduce this issue by calling channel auth API that response unexpected data with http 200 status code.

for example:

POST /api/channels/auth   <- the endpoint of channel auth API.

{ }    <- response body

then pusher-js will emit a “pusher:subscription_error” event with undefined error.

this issue is not a critical bug but may cause debugging more difficult.

0reactions
Nickbahsoncommented, Jul 11, 2022

I guess the other option is to handle active (persistent) sessions from within your application, to compliment the pusher api for this issue https://github.com/pusher/pusher-js/issues/485

Read more comments on GitHub >

github_iconTop Results From Across the Web

VueJS - Invalid handler for event "click": got undefined
I have got the similar error when the click function was implemented as computed function. Problem got resolved after the function got moved ......
Read more >
Deal with Undefined 'this' in React Event Handlers Correctly
You think this is pointing to the Sample class, but what you get is a nasty error. TypeError: Cannot read property 'foo' of...
Read more >
$A.get for application event is undefined, or can only fire ...
If I use $A.get to get the event one level up and refer to that in the click handler, I can only fire...
Read more >
event error handler javascript Undefined.
if I put it in a document ready function I get undefined. not sure what to do. index view. @model Jlo4MVC.Models.UserToSend.
Read more >
Event Tickets Plus – Undefined Function
After updating the plugins I received a Undefined Function Error for the function: tribe_tickets_new_views_is_enabled();. I looked through all the files for ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found