How to set per-route function durations in an Astro project on Vercel?

Hi everyone,
I’m working on an Astro project deployed on Vercel and I’d like to set different function durations for specific routes (not just globally at the project level).
I’ve tried adding patterns under functions in vercel.json, for example:

{
  "functions": {
    "api/aps/models/**/report": {
      "maxDuration": 60
    }
  }
}

But during the build I get errors like:
Error: The pattern “api/aps/models/**/report” defined in functions doesn’t match any Serverless Functions inside the api directory.
Learn More: Error List
I can set maxDuration at the project level without problems, but I haven’t figured out how to apply it per route in Astro.
Is there a way to configure per-route function durations in an Astro project, or is this currently unsupported?
Thanks in advance :folded_hands:

The vercel.json functions will map directly to the ones you see in your deployment summary

Anything under Functions should be configurable via vercel.json by writing a matching path. If Astro does not give you individual functions for each route here, then there won’t be a way to configure it at the Vercel level currently

Though if you want to give a lower timeout for one route than the project, you may be able to enforce that within your app code

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.