crowbartools / Firebot

A powerful all-in-one bot for Twitch streamers
https://firebot.app
GNU General Public License v3.0
316 stars 88 forks source link

[Bug] Bits Badge Event doesn't trigger due to error #2532

Open dennisrijsdijk opened 2 months ago

dennisrijsdijk commented 2 months ago

Is there an existing issue for this?

Current Behavior

Whenever a viewer unlocks a bits badge and sends the "bits badge unlocked" message/alert through Twitch, Firebot doesn't detect the bits badge event and throws the error shown below

Expected Behavior

Firebot should not throw any error, and should process the bits badge event.

Steps To Reproduce

  1. Have an Affiliate or Partner channel.
  2. Have a viewer unlock a bits badge.
  3. Have the viewer share the bits badge message/alert.
  4. Observe error in developer console or log file.

Version

5.62.1

What operating system are you using Firebot on?

Windows 11

Relevant log output

[2024-04-28 20:55:39.0552] - error: [v5.62.1] TypeError: Cannot read properties of undefined (reading 'user_name')
    at get userName [as userName] (C:\Users\danhu\AppData\Local\firebot\app-5.62.1\resources\app.asar\node_modules\@twurple\pubsub\lib\messages\PubSubBitsBadgeUnlockMessage.js:20:50)
    at PubSubHandler._callback (C:\Users\danhu\AppData\Local\firebot\app-5.62.1\resources\app.asar\build\backend\twitch-api\pubsub\pubsub-client.js:63:70)
    at PubSubHandler.call (C:\Users\danhu\AppData\Local\firebot\app-5.62.1\resources\app.asar\node_modules\@twurple\pubsub\lib\PubSubHandler.js:38:14)
    at C:\Users\danhu\AppData\Local\firebot\app-5.62.1\resources\app.asar\node_modules\@twurple\pubsub\lib\PubSubClient.js:63:33
    at BasicPubSubClient.emit (C:\Users\danhu\AppData\Local\firebot\app-5.62.1\resources\app.asar\node_modules\@d-fischer\typed-event-emitter\lib\EventEmitter.js:31:17)
    at BasicPubSubClient._receiveMessage (C:\Users\danhu\AppData\Local\firebot\app-5.62.1\resources\app.asar\node_modules\@twurple\pubsub\lib\BasicPubSubClient.js:313:22)
    at C:\Users\danhu\AppData\Local\firebot\app-5.62.1\resources\app.asar\node_modules\@twurple\pubsub\lib\BasicPubSubClient.js:94:18
    at PersistentConnection.emit (C:\Users\danhu\AppData\Local\firebot\app-5.62.1\resources\app.asar\node_modules\@d-fischer\typed-event-emitter\lib\EventEmitter.js:31:17)
    at C:\Users\danhu\AppData\Local\firebot\app-5.62.1\resources\app.asar\node_modules\@d-fischer\connection\lib\PersistentConnection.js:83:46
    at WebSocketConnection.emit (C:\Users\danhu\AppData\Local\firebot\app-5.62.1\resources\app.asar\node_modules\@d-fischer\typed-event-emitter\lib\EventEmitter.js:31:17) uncaughtException

Contact Details (Optional)

No response

zunderscore commented 2 months ago

Since PubSub deprecation has been announced by Twitch, we'll leave this for now until we can migrate that event to EventSub.