// troubleshooting guide · posthog
PostHog Node Not Sending Events in Serverless (Vercel, Lambda, Next.js)
- Status
- Workaround available
- platforms:
- Node.js, Next.js, Vercel, AWS Lambda, Cloudflare Workers
- updated:
- November 23, 2026
- reports:
- 3
- Method
- how we research
RUNBOOK · posthog/serverless-events-missing4 FIXES
// quick answer
posthog-node batches events and sends them later, so a serverless function that freezes after returning its response drops them. Set flushAt to 1 and flushInterval to 0, then await shutdown() (or flush()) before the function ends.
Most likely fix: Send each event immediately in serverless code
How to fix it
// try these in order, the most common fix is first
FIX 1Send each event immediately in serverless code
- 01Create the client with new PostHog(token, { host, flushAt: 1, flushInterval: 0 })
- 02Use this only for serverless or edge code; a long-running Node server should keep the default batching with one shared client
Did this fix it?FIX 2Await shutdown before the function returns
- 01After capturing, call await posthog.shutdown() before returning the response
- 02On Next.js 15.1 or later, wrap it in after(() => posthog.shutdown()) so the request is sent after the response without delaying it
- 03Do not reuse a client after shutdown(); use flush() for per-request cleanup on a shared client
Did this fix it?FIX 3Bound the flush on AWS Lambda
- 01flush() has no overall timeout, so race it against context.getRemainingTimeInMillis() minus about 100 ms
- 02Keep the handler awaiting the race so Lambda does not freeze mid-request
Did this fix it?FIX 4Confirm the server can reach PostHog
- 01Temporarily set host to a webhook.site URL and trigger the route
- 02If nothing arrives, fix initialization; if it arrives, set host back to https://us.i.posthog.com or https://eu.i.posthog.com to match your project
Did this fix it?
SANDBOX · posthog RUNS IN YOUR BROWSER
Try it: chart events, find the funnel drop-off, watch the session, roll out a flag
A hands-on PostHog-style sandbox, including the spots where users get stuck. See where problems like this one start. 1-2 minutes, nothing is saved.
Symptoms
Server-side events from API routes, Server Actions, Lambda handlers or edge functions never appear, or only some of them do, while the same code works locally with a long-running server.
Why it happens
- C-01The SDK queues events (default flushAt 20, flushInterval 10 seconds) and the function is frozen before the queue is sent
- C-02shutdown() or flush() is never awaited at the end of the request
- C-03A new client is created per request without shutting it down
- C-04Wrong project token or region host on the server (US vs EU)
// this guide also covers
- posthog node not sending events
- posthog serverless events missing
- posthog vercel events not showing
- posthog lambda events lost
- posthog-node shutdown
- posthog flushAt 1
Still not working?
If PostHog keeps failing, you're not alone. See every PostHog problem users report or the alternatives people switch to.
Done fighting PostHog? Our small team builds your own PostHog alternative, or any software you need: web, mobile, games, desktop. Price agreed together.
Talk to usThe same problem in other apps
All missing or lost data guides →
Mixpanel Events Not Showing (Mixpanel)
Amplitude Events Not Showing (Amplitude)
Hotjar Heatmap Not Showing Data (Hotjar)
Plausible Custom Events and Goals Not Showing (Plausible Analytics)
Microsoft Clarity Heatmap Not Showing Data (Microsoft Clarity)
Other PostHog errors
- PostHog Events Not Showing Up
- PostHog Blocked by Ad Blockers
- PostHog Session Replay Not Recording
- PostHog Replay Broken: Missing CSS, Fonts or Blank Screen
- PostHog Bill Too High
- PostHog Feature Flags Not Working or Undefined
- PostHog Pageviews Missing or Duplicated in Next.js
- PostHog Numbers Different From Google Analytics