EventSub on AWS (NodeJS)

I’m not sure if I’m supposed to ask here on AWS support. I must have been living under a rock for the last few months because I have only just found out that the older Webhooks are sunsetting very shortly. I have been working as hard as I can to migrate my applications across over the last few days, but I’m hitting a wall.

My previous webhook setup was using Daniel Fischer’s twitch-webhooks package on 8000-ish ports on an AWS EC2 server (my node-js installation can’t access privileged ports because it’s using nvm)

I understand that to use EventSub I need SSL listeners on port 443, so I had set up some AWS Load balancers to provide some SSL endpoints.

I have 3 or 4 different applications that require EventSub for different purposes, can somebody advise on the best setup for me?

To clarify, I’m not asking what EventSub subscriptions I need, just the logistics of getting multiple EventSub processes on (ideally) 1 EC2 server. The webhook versions did happily coexist on the same server running on different 8000-range ports.

Switch over to Daniel Fischer’s twitch-eventsub is likely the simplest solution for you

Thank you, I have just worked on porting my code over to Twurple v5.0.0 since the stable version of that package was just released a few hours ago.

But my question wasn’t actually about which package to use, it was actually about the best way to do this on a single server, knowing I used to be able to just run HTTP servers on non-standard ports, but now each of them need to be running on standard HTTPS on port 443, which as you know is not possible on a single machine.

Perhaps this isn’t the best support channel for my question. I think I need to ask AWS community support.

To run multiple http servers you usually have one setup as a reverse proxy and then forward the incoming requests to each service as needed. So you can run your eventsub handler internally on any port, but you’d receive your events on like eventsub.mydomain.com and since you specified a sub domain your reverse proxy knows which service that data should be forwarded to

I wouldn’t run multiple servers.

I’d run one server with multple routes instead.

or use the user/broadcaster ID included in the POST payload to determine where to send store data.

So I’d have one server with one route and process/relay data based on the contents of the message

And yeah I’d use nginx to SSL terminate and proxy pass to my node service(s)

Course, for this I don’t use a library anyway (just express for inbound HTTP and all my eventsub logic is custom based on https://github.com/BarryCarlyon/twitch_misc/tree/main/eventsub/handlers/nodejs )

So you’re saying I should run one instance of an EventSub listener directly connected to port 443 that services all my applications, which then determines what to do with each request depending on who/what it is for?

Personally I’d run nginx on 443 which proxy passes to node.

Then my node service doesn’t have to deal with/handle SSL let Nginx handle it insteaad.

Yup, then you only need the one node service/handler/route.

OK, thank you. Nginx does seem like it’s the way to go since that will be outside my node installation and can be run as root, unlike my damn nvm node installation :slight_smile:

This also reminds me I need to set my server’s hostname to my domain to avoid SSL errors. Previously I was just using the default ec2 IP-based hostname, and just recently pointed a new domain to the server IP for SSL reasons.