Waking up a twitter bot with uptime robot


#1

Project: lava-sand

It’s a twitter bot that searches twitter for a particular hashtag, go through (and further filter) the search results, then send a POST request to an external server so that the result can be viewed on a web page.

I have set up my uptime robot, but that uptime robot never actually made the twitter bot run (the only instance where the bot runs is when I change the code on Glitch). Accessing the end point of the twitter bot (either with my browser or with uptime robot) returns a 502 bad gateway or a 504 gateway timeout after a long while, without running the bot. What should I do?


#2

What value have you specified for process.env.BOT_ENDPOINT? In any case, since the root page is a valid end-point, you could just direct uptimerobot to hit https://lava-sand.glitch.me/ which works fine.


#3

process.env.BOT_ENPOINT=“nonsense”. And the endpoint I was trying to hit was https://lava-sand.glitch.me/nonsense

I’ll now try waiting for uptime robot to hit that root endpoint. (and I still don’t expect it to work)

One more question, does hitting endpoints manually in a browser do the same job as hitting with uptime robot? Or are they different? If they are the same - when I manually hit the end points it doesn’t update? And do you (or anyone else) know which bit of code run when someone hits the end point??


#4

Ah, I didn’t realise you were using the end-point to not just keep the bot awake but also update it.

The endpoint is working fine, but having looked at the endpoint handler code though, there’s no code logic at all in it. This is why it’s timing out. The code comment from the template project you remixed directs you to look at, and use code from example.js to add logic to the end-point, so I suggest you do that.

Or if you intended to run the other code in server.js with the end-point, then make sure the code you want to run is between the braces surrounding the app.all().