Bot keeps going down despite I am pinging it every 2 minutes

I also added these lines to server.js but it isn’t helping:
//alive
const express = require(“express”);
const app = express();

app.get("/", (request, response) => {
console.log(“Ping received!”);
response.sendStatus(200);
});

// listen for requests :slight_smile:
const listener = app.listen(process.env.PORT, function() {
console.log('Your app is listening on port ’ + listener.address().port);
});
//alive

response.send("hello");

Some text is required, not just a status.

Okay, I will add that and check and what about Python bots? How can I keep them alive?

@Anish Adding that line gives me this error Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client

@Daksh777, your code is correct in the OP, @Anish returning a status will also work (especially sending the status 200). The error that you’re getting right now is caused because you are already sending a status of 200. Once the status is sent, you can’t do a res.send() again to send some text.

So what should I do right now? The bot won’t stay online