Skip to content

fix(webhook): return 500 on handler failure to enable Telegram retries#86

Open
Dhereal1 wants to merge 1 commit intoHyperlinksSpace:mainfrom
Dhereal1:fix/webhook-reliability
Open

fix(webhook): return 500 on handler failure to enable Telegram retries#86
Dhereal1 wants to merge 1 commit intoHyperlinksSpace:mainfrom
Dhereal1:fix/webhook-reliability

Conversation

@Dhereal1
Copy link
Copy Markdown
Contributor

@Dhereal1 Dhereal1 commented Apr 2, 2026

Problem

Webhook always returned HTTP 200 immediately while processing updates asynchronously.
If handleUpdate failed, the error was logged but Telegram considered the update delivered successfully, resulting in silent message drops.

Fix

  • Await bot.handleUpdate(...) directly in the request lifecycle
  • Remove reliance on waitUntil for core update processing
  • Return HTTP 500 on failure so Telegram retries delivery
  • Keep per-chat serialization to preserve message order

Result

  • Failed updates are retried by Telegram
  • Eliminates silent message drops
  • Improves reliability under transient errors

Testing

  • Verified locally with polling mode
  • /start responds correctly
  • Simulated failure returns 500 and does not silently succeed

Copy link
Copy Markdown
Member

@staindart staindart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is likely not needed as we should feedback Telegram with 200 for the bot correct work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants