API sending 429 error

Hey guys

We're currently using the Node.js library on our API. We have recently been getting a lot of errors from the Prismic API. This is the error we're seeing:

Error: Unexpected status code [429] on URL https://xxx.prismic.io/api/v2?access_token=xxxx
at /var/task/node_modules/prismic-javascript/dist/prismic-javascript.min.js:1:16437
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
   status: 429
}

I tried to dig up more info and couldn't really find much except a note here saying that Prismic doesn't limit API requests.

So in reality are there API limits or throttles in place? Would just be good to know so we can build accordingly.

Cheers!

1 Like

Hi Matt,

Thanks for posting! At first glance, I’m not sure what this error might be caused by. Could you send me a DM with the name of your repo? And also the code snippet that is causing the problem? Then I’ll send a message to our development team to see if they can help.

Sam

Thanks Sam, message sent.

@samlittlefair Also seeing this error regularly. Anything we can do?

Hey Matt and Sunil,

I’ve submitted an issue to our development team, and I’ll let you know what I hear back. Let me know if there’s anything else I can help with in the meantime.

Sam

1 Like

Also had this a few times, seems like in the past few days mostly. Using gatsby-source-prismic-graphql - not sure if that makes a difference.

Hey @matt.sanders,

Sometimes this error can happen if you’re not using the CDN. If you change your api endpoint to https://xxx.cdn.prismic.io/api/v2?access_token=xxxx, does that help with the error?

Sam

@sunil and @sean, thanks for posting!

Sunil, are you using the REST API? And, if so, are you using the CDN like I mentioned above to Matt?

Sean, I don’t think GraphQL has the same issue with the CDN, so I’ll need to do some more investigating. Can you send me the code that is generating the error, either on this thread or in a DM?

Yes…
https://xxx.cdn.prismic.io/api/v2/documents/search OR https://xxx.prismic.io/api/v2

Ah ok, I’ll make that change and we’ll see how we go. Thanks @samlittlefair

@samlittlefair just wanted to follow up on this, we haven't seen any more errors since making these changes a week or so ago, so I think it's fair to say that fixed the issue. Thanks heaps!

Might be worth updating the docs though. I was following this guide which has the apiEndpoint set as https://your-repository-name.prismic.io/api/v2 so adding the cdn in there would help alleviate these issue for further devs.

Hey @Sunil,

Sorry for the delay in responding. You're getting the error using the Rest API, with https://xxx.cdn.prismic.io/api/v2/documents/search?

Could you share your repo name, the technology you're using, and the code for the page that is throwing the error? You can send it in a DM if you don't want to share it publicly.

Thanks,
Sam

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

@matt.sanders Thanks for pointing that out! I've updated all of the documentation to ensure that all endpoints include the CDN.