Significant latency overhead (~500ms) after upgrading to Functions v5 (Standard API)

Hello,

We recently upgraded our project from @netlify/functions v3 to v5. As part of the upgrade, we converted our handlers to use the new Standard Web API signature (Request / Response).

We are seeing a roughly 2x latency increase across ALL our endpoints. I am using our Auth handler (powered by better-auth) as the specific example below, but the overhead is present on every function using the new v5 signature.

We added internal profiling to measure execution time, and there is a massive discrepancy between how long our code takes to run and the total time reported by Netlify.

Note: The logs below were captured running locally via Netlify Dev, but we are seeing this exact same latency penalty in our deployed production environment.

Scenario A: Functions v5 (Standard API) When using the new export default async (req, context) syntax, we see a ~500ms gap between our handler finishing and the response being sent.

Plaintext

Request from ::1: GET /api/auth/get-session
[Auth Function] GET /api/auth/get-session | Auth Handler: 338.89ms | Total: 338.90ms
Response with status 200 in 821 ms.

  • Handler Time: ~339ms

  • Total Request Time: ~821ms

  • Unaccounted Overhead: ~482ms

Scenario B: Reverted to Legacy Signature To debug this, we reverted the exact same function to the legacy export const handler = async (event, context) signature (bypassing the Request/Response objects). The overhead disappears immediately:

Plaintext

Request from ::1: GET /.netlify/functions/auth/get-session
[Auth Function] GET /api/auth/get-session | Auth Handler: 306.56ms | Total: 306.57ms
Response with status 200 in 309 ms.

  • Handler Time: ~306ms

  • Total Request Time: ~309ms

  • Overhead: ~3ms

Additional Context

  • Routing: We removed the manual redirect rules from our netlify.toml and are relying on the function configuration to handle the routing.

  • Codebase: This is a public repository. You can view the specific Pull Request where we implemented these changes (and saw the regression) here.

Question It seems that the routing or adapter layer for the new v5 Standard API is adding roughly 500ms of latency to every request compared to the legacy signature.

Has anyone else experienced this performance penalty with the new format? Is there a configuration setting we are missing to align the performance of the v5 Standard API with the legacy signature?

Environment:

  • @netlify/functions: v5.x

  • Auth Library: better-auth

  • Node Version: (Set to Latest)

Thanks!

Hey @Cobresun :wave:,
Thanks for reaching out!

We’ve gone ahead and created a support ticket for you, so our team can follow up with you directly via email from the help desk. Our Support crew will be in touch with you by email soon.

Great news: these days anyone can reach out to Netlify Support. First, you can try getting an answer using Ask Netlify, our helpful AI search tool. If your question isn’t answered there, you can submit a ticket using the support form, and we’ll take it from there.

We’re keeping the community around for swapping ideas, sharing tips and tricks, and talking shop with other folks building on the platform — but for support issues, tickets are the way to go.

Thanks for being here, and keep an eye out for that email from us!