429 errors on site build

Hi, we have a project that was built using the @prismicio/gatsby-source-prismic-graphql plugin. We realize that has been deprecated, but this site was built when the graphql plugin was the recommended solution.

As of this morning, we are suddenly getting a bunch of 429 errors on site build:

error There was an error in your GraphQL query: Response not successful: Received status code 429

We have un-published the most recent content pushes, and that did not seem to resolve the issue, so we don't believe it to be content-specific. 429 represents a 'too many requests' error.

Is there anyone who can help us troubleshoot this further?

Hi @fitzgers,

As you mentioned, that error is a result of being rate limited. This could occur when using Gatsby if it makes too many requests to Prismic's GraphQL API while building pages. If you are able to determine where network requests are happening within your app, such as custom GraphQL calls, you could try combining them into single queries.

You could also try providing the plugin with a custom Apollo Link that automatically retries failed network requests. The createLink plugin option allows for passing a custom Link. You could combine the default Prismic Link (See here) and Retry Link.

You can read about the createLink option here: gatsby/packages/gatsby-source-graphql at master · gatsbyjs/gatsby · GitHub

I understand setting this up is not a straightforward task. Ultimately, the Apollo Link needs to either throttle its requests or retry failed attempts.

As you know, gatsby-source-prismic-graphql is deprecated so the plugin will not be further developed. I would highly recommend migrating to gatsby-source-prismic for a more native Gatsby approach to integrating Prismic when you are able to. It is officially supported by Prismic (including myself).

I hope that helps!

Thanks for the response @angeloashmore , that is quite helpful. We'll look in to the createLink option. We do plan to migrate to gatsby-source-prismic at some point in future, but it is a large site and the prospect is a bit daunting.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.