1

For anyone working on a nextjs project, who's struggling with GraphQL Error (Code: 429), here's a quick fix.

The back story...:

I built a headless CMS using Hygraph and NextJS 13 for a blog project. I also used the npm graphql-request package. I originally wanted to have it run on a server, but ended up deciding to use static generation so I could host the site using a simpler/less expensive hosting package. Up to the point where I had 10 posts, everything worked fine. Once I increased the number of posts, I got the error 429! Apparently Hygraph has a cap on requests per second based on the type of package you're using (I'm on the free one), so once you hit that cap, you'll get this error.

G6ix
  • 164
  • 1
  • 8
  • 1
    Hi @G6ix welcome to StackOverflow and thanking for posting a Q&A! Please add more content to both the question and the answer. What is the project setup? What version of NextJS and GraphQL are you using? What other relevant packages are you using? When does the error occur? How does your answer solve it? – Martin Devillers Mar 05 '23 at 22:01

1 Answers1

0

add this to your Next.js config file (next.config.js)

experimental: {
  workerThreads: false,
  cpus: 1
},

for more details pls refer to: HYGRAPH SOLUTION PAGE

G6ix
  • 164
  • 1
  • 8