Greetings! I am currently in the process of developing a Telegram bot using Firebase cloud functions with Typescript.
Despite my bot successfully executing its tasks, there seems to be an issue that is keeping my cloud functions persistently active, leading to an error as indicated in the title. It's puzzling how this error continues to occur even after the function has completed its task successfully.
This ongoing issue is not only filling up my cloud function logs but also increasing the count of function invocations.
https://i.sstatic.net/fg1SO.png
The problem persists, seemingly in a loop...
Here is the snippet of my code where the user command is received and split into two parts if it consists of two words:
app.post('/', async (req, res) => {
const isTelegramMessage = req.body
&& req.body.message
&& req.body.message.chat
&& req.body.message.chat.id
&& req.body.message.from
&& req.body.message.from.first_name
if (isTelegramMessage) {
// Command processing logic
}
return res.status(200).send({ status: 'not a telegram message' })
})
export const router = functions.https.onRequest(app)
EDIT: Despite the successful completion of my function, the error continues to occur. Strangely, these errors persist even when I haven't sent any Telegram messages, indicating that the function is being invoked unnecessarily.
https://i.sstatic.net/9DOZI.png
Although the bot functions as intended, the error in question is causing an increase in function invocations.
https://i.sstatic.net/rjehX.png
Number of function invocations since the onset of this issue.