set vercel function config per route
Describe the feature
Would be neat to be able to have the build output multiple vercel functions to be able to have custom configuration for each. For example, I might have one endpoint where I wanna increase the maxDuration. Currently I have to do that globally for each route which could be costly.
Additional information
- [ ] Would you be willing to help implement this feature?
Thanks for describing your usecase. It is totally valid, and I think we could implement it without the need to split the bundle, but generate function aliases with different configs.
We currently do this for ISR and A11Y purposes, but it could be extended for full function config per route (pattern)
Re bundle splitting: (unrelated, I guess, mainly FYI)
Generally speaking, a single server instance has many benefits for reusing the same global state when handling requests. It helps to reuse the same connections (like DB) and cache entries, and revalidation between routes. This also applies to the vercel fluid model.
With the same bundle but multiple instances (proposal of this issue), we partially lose this, as we can have multiple states between instance groups. Splitting the bundle itself could also imply duplicate bundle contents (identical) to be evaluated multiple times for serving a single web page, which also costs.
Regardless, we plan to support multi-target builds (#1158), which can be useful in the vercel case too (global+region: #1120).