Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Uncaught Iteration Timeout errors from Airtable #58

Open
MoralCode opened this issue Apr 5, 2021 · 2 comments
Open

Uncaught Iteration Timeout errors from Airtable #58

MoralCode opened this issue Apr 5, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@MoralCode
Copy link
Contributor

I've been seeing quite a few instances of the following error in the monitoring software we use for vacfind:

Message: Error: Error: {"error":{"type":"LIST_RECORDS_ITERATOR_NOT_AVAILABLE"}}
at this.select/< line 1, column 6350 (https://vacfind.org/assets/js/asyncAirtable-beta.min.js:1)
at s line 1, column 4770 (https://vacfind.org/assets/js/asyncAirtable-beta.min.js:1)

I'm working on getting the included sourcemaps to process correctly, but this seems to me to be a relatively straightforward case of an UnhandledPromiseRejection.

Searching online leads me to this issue that mentions this error message and refers to the Airtable API docs which state that:

Iteration may timeout due to client inactivity or server restarts. In that case, the client will receive a 422 response with error message LIST_RECORDS_ITERATOR_NOT_AVAILABLE. It may then restart iteration from the beginning.

I have not personally found a way to reproduce this issue since the docs seem to say that it only happens in cases of timeouts or the airtable server going down. Although airtable seems to briefly (<30 sec) go down somewhat frequently, this isn't something that I am able to reproduce intentionally.

Would you accept a PR to add in a handler to catch these 422 LIST_RECORDS_ITERATOR_NOT_AVAILABLE errors, and If so, how would you prefer to have AsyncAirtable handle it?

@MoralCode
Copy link
Contributor Author

MoralCode commented Apr 5, 2021

From looking at the minified code around the place where it says the error is, it seems like this issue is being caused by this Async call:

return await rateLimitHandler(
url,
{
method: 'post',
body: JSON.stringify(body),
headers: {
Authorization: `Bearer ${this.apiKey}`,
'Content-Type': 'application/json',
},
},
this.retryTimeout,
this.maxRetry,
);

Edit: the sourcemap seems to suggest its actually this catch block that's throwing the error :

} catch (err) {
throw new Error(err);
}

i suspect this happens in cases where there are multiple pages of records to fetch and the Airtable server goes down or something in the middle of that interaction

@GV14982
Copy link
Owner

GV14982 commented Apr 5, 2021

Thanks for all your work on this!

Yeah feel free to submit a PR. If you opt not to I will take a look at it as soon as I have some more time!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants