Back to feed
Dev.to
Dev.to
5/10/2026
Why your Sentry events never reach your serverless functions

Why your Sentry events never reach your serverless functions

Short summary

Sentry's asynchronous event buffering fails silently on serverless platforms like Vercel because the Lambda runtime freezes the process before the transport completes. This causes the final check-in to never be sent, triggering false timeout alerts and hiding real incidents. The solution is straightforward: wrap Sentry.withMonitor calls in a finally block that awaits Sentry.flush(2000), ensuring all events drain before the Lambda terminates.

  • Sentry check-ins are lost on serverless when Lambda freezes before async transport completes
  • Solution: await Sentry.flush(2000) in a finally block to drain the buffer
  • Pattern applies to all serverless functions that depend on Sentry events

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Explore more