Next.js Discord

Discord Forum

Vercel Edge Middleware gets triggered inflationarily; Usage at risk

Unanswered
Brewer's Blackbird posted this in #help-forum
Open in Discord
Brewer's BlackbirdOP
I'm building a blog-like website with Next.js and Vercel. I am trying to stay within the usage limits of the Vercel Hobby plan.

However, e.g. on my index page, each link present on a page, triggers an Edge Middleware call, which skyrockets my "Function Invocations" limit.

I'm looking for help, either caching those triggered Edge Middleware functions to decrease function invocations and improve page speed; or preventing links that are merely present on a page - without being clicked - triggering such a Edge Middleware function invocation.

Thanks a lot for your help! If any additional info might be helpful, let me know what I can provide 🙂

3 Replies

you can try disabling prefetch
Brewer's BlackbirdOP
Yeah, that helps! Thank you 🙂

I still do not know, how to cache serverless functions and edge middleware... When I try to add caching headers, navigation just leads to a blank page, like a waiting screen, without any network request being active - at least according to Chrome dev tools...