-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[sitecore-jss][templates/nextjs] Handle rate limit errors in Layout and Dictionary Services through GraphQL Client #1618
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will happen in case of graphql-personalize-service, graphql-redirects-service, etc... all the services that are using GraphQLClient, since you covered only dictionary, layout services?
packages/create-sitecore-jss/src/templates/nextjs/src/lib/dictionary-service-factory.ts
Outdated
Show resolved
Hide resolved
packages/create-sitecore-jss/src/templates/nextjs/src/lib/dictionary-service-factory.ts
Outdated
Show resolved
Hide resolved
packages/create-sitecore-jss/src/templates/nextjs/src/lib/layout-service-factory.ts
Outdated
Show resolved
Hide resolved
packages/create-sitecore-jss/src/templates/nextjs/src/lib/layout-service-factory.ts
Outdated
Show resolved
Hide resolved
In case of personalize service that's intentional. We should not have personalize be slow, and if it fails it should fail fast, not wait for one second or more. |
@art-alexeyenko For example "redirects-service" is called on each request, like dictionary, layout services. What about this case? |
I think retryer is not a good fit for a redirects-service either. Redirects is something that won't be updated too often, is something that isn't too large, and redirects are retrieved on per-site basis. With this, instead of bombarding GQL endpoint with retry redirects queries, it would be better to reduce how often redirect data is fetched - via storing it in app for a certain time. It would be better than retrieving all the redirects for every page render. |
* [sitecore-jss-nextjs] Reduce the amount of Edge API calls during fetch `getStaticPaths` (#1612) * [sitecore-jss][templates/nextjs][templates/nextjs-sxa] Handle rate limit errors in Layout and Dictionary Services through GraphQL Client * Updated CHANGELOG
Description / Motivation
GraphQL endpoints can reply with a code 429 response when too many requests are launched (i.e. during static page generation). This PR adds a retryer functionality to GraphQL Client in sitecore-jss package to prevent 429 errors crashing a nextjs build.
To enable it, specify the number of retries for GraphQL services in dictionary-service-factory and layout-service-factory.
Retry will either read the 'Retry-After' header and send another request after the specified timespan, or use 1 second between retries by default.
Testing Details
https://doc.sitecore.com/xp/en/developers/103/sitecore-experience-manager/throttle-requests.html
Types of changes