"API calls quota exceeded" error when building Next.js-based JSS applications


Description

Building Next.js-based JavaScript Services (JSS) applications connected to XM Cloud and Experience Edge might result in the following error:

ClientError: GraphQL Error (Code: 429):
{"response":{"error":"API calls quota exceeded!
maximum admitted 80 per
1s.","status":429,"headers":{}}

The issue occurs due to Next.js using multiple threads during static site generation, and therefore running multiple requests to GraphQL endpoint.

Solution

To resolve the issue, upgrade to Sitecore JSS 21.4.0 or later.

 

Alternatively, you can consider either one of the following options or their combination: