Telegram webhook IPs restrictions check

i have an issue with telegram webhook. All settings is correct, but when telegram send webhook on vercel, nothing happens and no any records on vercel logs.

Telegram webhook last error is :
"last_error_message":"Wrong response from the webhook: 401 Unauthorized"

I googled not resolved relevant problem: Telegram Bot Not Responding Despite No Error Logs - Webhook Configured

I think thats because vercel ban telegram`s IP.
Is it possible can you check any restrictions for telegram IPs:

91.108.5.36
216.198.79.129

My deployment url is : ai-tm-fitness – Deployment Overview – Vercel

Hi @mflash123, can you try triggering the webhook manually from Telegram’s side and observe the runtime logs for your application. Aer you using some signed secret authentication inside your webhook code that might be failing and returning 401?

I can call webhook manually from Telegram, but I dont have any access to telegram side to see the full log.
There no any auth payload.
Telegram makes POST call on vercel which contains the uniq token.

Same configuration works on local ant on other serverless cloud products. So, this is no any code issue, 100% this is some issues between vercel and telegram.

I am sure, this is some IP restrictions, can you check them?
@anshumanb

I see. About runtime logs: I meant can you check the runtime logs in Vercel when you request from Telegram?

About IP restrictions, let’s first rule out all things by checking request logs and Firewall logs.

I see. About runtime logs: I meant can you check the runtime logs in Vercel when you request from Telegram?

no any records from Telegram request, like request does not passing to me.

Just my logs to check is app is up
Link to logs
@anshumanb

Can you confirm that you checked the logs right after making the request? Because you are on the hobby plan so the logs are only kept for 60 minutes.

I find the problem, but hope you give me solution.
I find out what request Telegram sends on vercel and tryies make same request and get 401 from vercel.

Check it
curl -X POST "https://ai-tm-fitness-gb8fy52dx-mflash123s-projects.vercel.app" -H "Content-Type: application/json"

So, in deployment section there is Domains - block
But I can access there only throught vercel auth.

How can i make this URL public? Or where I can get the public urls to deployments?

@anshumanb

Hi @mflash123, this seems like a preview deployment to me because it is asking me for authentication. I would recommend using the production domain.

this seems like a preview deployment to me because it is asking me for authentication.

Yes, absolutely same problem with telegram webhook. is it possible to convert preview deployment to production?
The problem is, in main branch my stable version,.
In dev - new feature. I want test the dev and it deploys as a preview. And it caused the auth error

This issue is fixed, but i have a new one with same participants..

vercel cant make any request to Telegram. It is crashing with error
Unhandled Rejection: FetchError: request to https://api.telegram.org/bot[REDACTED]:[REDACTED]/getMe failed, reason: Client network socket disconnected before secure TLS connection was established

This is SSL issue.

Hi @mflash123, I’m glad you fixed the deployment protection issue.

About the new one, I think either the URL or something else is not working in your code. Are you able to run the same code locally? Does this code require a long running task? Maybe the Telegram API didn’t respond in time.

Can you try using some /ping endpoint from Telegram API that just confirms the connection?