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

EventSubListener failing to subscribe to topics if previous failures occured #565

Closed
theca11 opened this issue Mar 7, 2024 · 0 comments
Closed
Labels

Comments

@theca11
Copy link
Contributor

theca11 commented Mar 7, 2024

Bug Report

EventSubListener fails to subscribe to topics when it has previously failed more than one (different) subscription due to the token missing proper scopes. Yeah, not the most understandable sentence - let's give some examples, supposing we're trying to subscribe to topics A, B and C, each requiring certain scope:

  • Case 1: token has all 3 scopes -> all subscriptions succeed (as expected)
  • Case 2: token has scopes B and C, but not A -> subscriptions A fails, subscriptions B and C succeed (as expected)
  • Case 3: token only has scope C -> all 3 subscriptions fail, when subscription C should have succeed. The error thrown when trying to subscribe to C yells about scope B missing. So somewhere there is some cache or whatever once 2 subscriptions have failed that cause further subscriptions to fail too.

Code

Using a minimal setup:

const authProvider = new RefreshingAuthProvider({ clientId, clientSecret });
authProvider.addUser(broadcasterId, tokenData);
const apiClient = new ApiClient({ authProvider });
const eventsubListener = new EventSubWsListener({ apiClient });
eventsubListener.start();

eventsubListener.onSubscriptionCreateSuccess((subscription) => {
  logger.info(`Successfully subscribed to ${subscription.id}`);
});

eventsubListener.onSubscriptionCreateFailure((subscription, error) => {
  logger.error(`Error subscribing to ${subscription.id}:`, error);
});

eventsubListener.onChannelRedemptionAdd(broadcasterId, () => console.log('Redemption add event'));
eventsubListener.onChannelAdBreakBegin(broadcasterId, () => console.log('Ad break event'));
eventsubListener.onChannelChatMessage(broadcasterId, broadcasterId, () => console.log('Chat message event'));

Expected behavior

channel.chat.message succeeds whenever the token has user:read:chat despite previous topics failing to subscribe

Actual Behavior

channel.chat.message fails if the token only contains user:read:chat (i.e. when both the previous topics fail to subscribe) (logs below). It does succeed when either the token has all scopes or has user:read:chat plus another of the scopes (i.e. only one previous topic failing).

[2024-03-07T14:34:32.298Z][error] Error subscribing to channel.channel_points_custom_reward_redemption.add.XXXXXXXX: This token does not have any of the requested scopes (channel:read:redemptions, channel:manage:redemptions) and can not be upgraded.
[2024-03-07T14:34:32.314Z][error] Error subscribing to channel.ad_break.begin.XXXXXXXX: This token does not have any of the requested scopes (channel:read:ads) and can not be upgraded.
[2024-03-07T14:34:32.330Z][error] Error subscribing to channel.chat.message.XXXXXXXX.XXXXXXXX: This token does not have any of the requested scopes (channel:read:ads) and can not be upgraded.

Environment

  • Version: 7.1.0-pre.7
  • Node version: v20.11
  • Operating system: Windows 10
@theca11 theca11 added the bug label Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant