A 429: FUNCTION_RATE_LIMIT error on your Vercel Serverless Function indicates that the default limit of 30,000 concurrent executions has been reached. Although rare, this guide discusses potential causes and steps to resolve or mitigate this issue.
Understanding Concurrency
Concurrency refers to the ability of your Serverless Function to handle multiple executions simultaneously.
Identifying Concurrent Issues
Exceeding the concurrency limit may indicate a deeper issue. If the serverless execution time per request is increasing, it suggests that the available function capacity is being utilized fully. It's advisable to check your upstream provider (API, Content Management System, Database, etc.) to ensure it scales alongside Vercel, as increasing concurrency may strain your upstream provider further.
Vercel Function Autoscaling
Vercel automatically scales the number of function instances based on demand, up to a maximum of 30,000 concurrent executions. This feature of our managed infrastructure is available on all plans and ensures optimal performance during traffic surges without requiring manual intervention.
Learn more about automatic concurrency scaling for Vercel Functions.
Burst Concurrency
Burst concurrency allows for a temporary increase in the concurrency limit to handle sudden traffic influxes. After the initial burst, Vercel continues to scale your function by a maximum of 500 concurrency per minute up to 30,000.
The scaling process might take several minutes, especially during substantial traffic increases, to ensure a smooth scaling experience that aligns with natural traffic patterns and minimizes impact on performance.
Learn more about burst concurrency on Vercel.
Other Solutions
Caching Headers
If your response can be cached, even for a short duration, adding appropriate cache-control
headers can help reduce the number of requests reaching your function, while also improving response times.
Learn more about caching on Vercel.
Incremental Static Regeneration (ISR)
Utilize Incremental Static Regeneration (ISR) to generate static pages on-demand, which can help manage high-traffic events effectively.
Limiting Function Maximum Duration
You can limit the maximum duration for your functions to ensure they do not run longer than necessary, which can also help in managing resources better.