Functions: Enhanced recursion protection and increased rate limits

Sanity Functions now includes improved safeguards and higher throughput limits. Recursion protection limits function chains to 16 invocations when mutating documents, reducing the risk of exceeding usage limits. Rate limits have increased significantly to support higher-volume workloads.

✨ Highlights

Improved recursion protection

Functions now limits recursive invocations to 16 when you mutate documents from within a function. This protection reduces the risk of exceeding your usage limits when a function triggers another function or itself through document mutations. You should still use caution when mutating documents from within functions.

This feature requires @sanity/client v7.12.0 or later.

Increased rate limits

Rate limits for Functions have increased to support higher-volume applications:

Individual function limit: 200 invocations per 30 seconds (previously 10 invocations per 30 seconds).

Project-wide limit: 4,000 invocations per 30 seconds (previously 200 invocations per 30 seconds).

When you exceed these limits, Functions stops additional invocations until the rate drops below the threshold.