Retry on 429 error #1318
-
I'm using Graffle (currently 8.0.0-next.157) in a Nuxt app to fetch data from Storyblok. I've experienced some 429 rate limit responses and and I'm wondering how to handle those (and other errors) — ideally by automatically retrying a certain number of times with delays in-between. Here's roughly what I'm doing: import { Graffle } from 'graffle'
const graffle = Graffle
.create()
.transport({
url: 'https://gapi-us.storyblok.com/v1/api',
headers: {
Token: '<TOKEN>',
Version: 'published'
}
})
const document = graffle.gql`
query getPage($id: ID!) {
PageItem(id: $id) {
name
full_slug
content
}
}
`
const data = await document.send({ id: 'home' }) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hey @egrossnickle there used to be a retry but I temporarily removed this while trying to re-work various aspects of core. Until now I didn't know anyone was/would using that feature so its great to hear your feedback. As it stands, without that transparent retry support built into the anyware system, you're going to have to build the retry on the outside/around your graffle client. I realize that is not ideal! I will make an issue to track brining retry back! |
Beta Was this translation helpful? Give feedback.
Yes, the result should have the response when you are using the envelope. Example: https://graffle.js.org/examples/output/envelope