I created a small Telegram bot using one of my Vercel functions, without using any libraries other than node-fetch@2.7.0. The bot uses fetch to get data from another API. Sometimes, when that API doesn’t respond, the function times out and returns a 504 status to Telegram. This causes Telegram to call my webhook URL again with the same data, creating a loop.
Not only does this happen, but it also causes my other functions to start timing out, even though they don’t have any issues. I still haven’t found an easy way to fix this