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

subscribe-message webhook events are not dispached correctly #282

Closed
OdatNurd opened this issue Aug 19, 2021 · 0 comments
Closed

subscribe-message webhook events are not dispached correctly #282

OdatNurd opened this issue Aug 19, 2021 · 0 comments
Labels

Comments

@OdatNurd
Copy link
Contributor

Bug Report

The event handlers for listening to a subscription ending and listening for a subscription resubscribe both use the same prefix string for their webhook endpoint and signing secret.

As a result, if you want to listen for both events, they both set up a webhook that goes to the same URL, and both events end up at a single endpoint.

Code

The definition of EventSubChannelSubscriptionMessageSubscription.id() is:

    get id(): string {
        return `channel.subscription.end.${this._userId}`;
    }

However, in HelixEventSubApi.subscribeToChannelSubscriptionMessageEvents, the string used is channel.subscription.message:

    return this.createSubscription(
        'channel.subscription.message',
        '1',
        { broadcaster_user_id: extractUserId(broadcaster) },
        transport
    );

Expected behavior

When subscribing to both unsubscribe and subscription-message events, each should be dispatched to their respective handlers, allowing for determining if a subscription is being created or is ending.

Actual Behavior

Both events trigger the same endpoint, requiring the code to examine the event object provided to try and determine which event it's actually receiving

Environment

  • Version: twitch-eventsub 4.6.5
  • Node version: v14.15.4
  • Operating system: Slackware Linux 14.2
@OdatNurd OdatNurd added the bug label Aug 19, 2021
OdatNurd added a commit to OdatNurd/twurple that referenced this issue Aug 19, 2021
This fixes twurple#282 by changing the prefix string returned by
`EventSubChannelSubscriptionMessageSubscription.id()` to match the one
returned by the similar method in  `HelixEventSubApi`.

A quick spot check shows that the other strings used across the two
classes otherwise line up, so presumably this was the intention when
this event was initially added.
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