mitchwadair / tesjs

Streamline your Twitch EventSub JavaScript integration with TESjs

Home Page:https://www.tesjs.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Interference With Some Express Middlewares

mitchwadair opened this issue · comments

Describe the bug
This only affects projects which are integrating with an existing Express server!!
If using an existing Express server, some middlewares (express.json() for example) interfere with the middleware used in TESjs.

To Reproduce
Steps to reproduce the behavior:

  1. have an Express server with express.json() middleware being used for all routes
  2. subscribe to an event (have debug on in config)

Expected behavior
Event subscription/notifications should come through fine

Actual behavior
The TESjs middleware does not work correctly, making any request from Twitch fail

The clear solution to this problem is likely to include a middleware with TESjs that will interface with other middleware to ignore the /teswh/event route:

// Example:
app.use(ignoreTES(express.json());

If there is a way to do this without requiring extra steps from a developer, that would be ideal though.