Skip to content

Fix Python 3.14 asyncio event loop crash in Mangum webhook handler#2536

Merged
hiroshinishio merged 2 commits intomainfrom
wes
Apr 16, 2026
Merged

Fix Python 3.14 asyncio event loop crash in Mangum webhook handler#2536
hiroshinishio merged 2 commits intomainfrom
wes

Conversation

@hiroshinishio
Copy link
Copy Markdown
Collaborator

@hiroshinishio hiroshinishio commented Apr 16, 2026

Summary

  • Python 3.14 removed implicit event loop creation in asyncio.get_event_loop(), causing Mangum's HTTPCycle.__call__ to crash with RuntimeError on every webhook invocation
  • 3027 out of 6462 CloudWatch log events in the last 2 hours were this crash — all webhook processing was broken
  • Schedule triggers (EventBridge) worked because they bypass Mangum; webhook events (GitHub PR opened, push, etc.) go through Mangum and crashed
  • Fix: ensure an event loop exists in handler() before calling mangum_handler(), same pattern Mangum uses at init time but executed at request time
  • Even Mangum 0.21.0 (latest) has the same bug — upgrading won't help

@hiroshinishio hiroshinishio self-assigned this Apr 16, 2026
@hiroshinishio hiroshinishio merged commit 3aae7f6 into main Apr 16, 2026
1 check passed
@hiroshinishio hiroshinishio deleted the wes branch April 16, 2026 05:42
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.

1 participant