# FastAPI Lifespan Events are now supported on Vercel

By Steven Van · 2025-12-09

FastAPI apps on Vercel can now run startup and shutdown logic, though shutdown cleanup is capped at 500ms.

FastAPI apps deployed on [Vercel](<https://creatorstoolbox.com/tools/vercel>) can now use lifespan events to run logic on startup and graceful shutdown, such as managing database connections or flushing external logs.

Lifespan events are defined with FastAPI's asynccontextmanager, running setup code before the yield and teardown code after it. Per the [FastAPI on Vercel documentation](<https://vercel.com/docs/frameworks/backend/fastapi>), shutdown cleanup is limited to 500ms after Vercel sends the SIGTERM signal, and logs printed during that shutdown step won't appear in the Vercel dashboard.

![Vercel](<https://www.google.com/s2/favicons?domain=vercel.com&sz=128>)

Vercel

The platform for frontend developers — deploy, preview, and scale web apps and AI agents with zero config.

[View Vercel →](<https://creatorstoolbox.com/tools/vercel>)

[Original source](<https://vercel.com/docs/frameworks/backend/fastapi>)

[Read FastAPI Lifespan Events are now supported on Vercel on Creators Toolbox](<https://creatorstoolbox.com/blog/vercel-fastapi-lifespan-events-are-now-supported-on-vercel>)

---
Canonical source: https://creatorstoolbox.com/blog/vercel-fastapi-lifespan-events-are-now-supported-on-vercel
