# Serverless flush (/docs/troubleshooting/serverless-flush)



Your handler works, but only *some* calls — or none — reach the dashboard. On AWS Lambda, Vercel
functions, Cloud Functions, Cloud Run, or any short-lived script, the cause is almost always the
same: usage is sent in the background, and the process froze or exited before it went out.

## The fix, shape by shape [#the-fix-shape-by-shape]

| Where you run        | Python                         | Node                             |
| -------------------- | ------------------------------ | -------------------------------- |
| Long-running server  | nothing needed                 | nothing needed                   |
| Serverless function  | `tp.flush_sync()` in `finally` | `await tp.flush()` in `finally`  |
| Script / CLI / batch | `tp.flush_sync()` at the end   | `await tp.shutdown()` at the end |

Put the drain in a `finally` so it still runs when the handler throws.

<Callout type="warn">
  **Node's `flushSync()` drains nothing.** It is diagnostic-only — it reports pending state and
  returns. The calls that actually drain are `await tp.flush()` and `await tp.shutdown()`. Python's
  `flush_sync()` *does* drain; the two SDKs differ here.
</Callout>

<Callout type="info">
  Setting `deployment="serverless"` in `init()` switches the SDK to its short-lived path but
  **does not flush for you** — you still wire one of the drains above.
</Callout>

Wrapper helpers (`tp.serverless(...)` / `@tp.serverless`), the Node async-handler caveat, and the
edge-runtime limits are all in
[Flushing & serverless](/docs/sdk/flushing-and-serverless).

## Next [#next]

<Cards>
  <Card title="Flushing & serverless" href="/docs/sdk/flushing-and-serverless" description="The wrapper helper, edge limits, and the full flush reference." />

  <Card title="Nothing in the dashboard" href="/docs/troubleshooting/nothing-in-dashboard" description="Other reasons traces don't arrive." />
</Cards>
