Vercel Releases Performance Cost

Heavy DB/network work in middleware.ts

Part of the Edge runtime readiness check · fix arrives as a guide

What it is

Middleware performs database queries or other network calls.

Why it matters

Middleware runs before every matching request, so its latency is added to every page load. A database round trip there is the single most expensive thing you can put on that path.

How to fix it

Keep middleware to cheap operations on data already in the request — reading a cookie, checking a header, rewriting a path. Move data-dependent work into the route handler where it can be cached.

Run them all on your app

Connect your repo and your live services with read-only scopes. The first scan is free, and nothing changes without your approval.