Apr 10, 2024 04:15 AM
Trying to debug code written by someone else. It seems that the following code doesnt return more than 100 records even though fetchnextpage is set.
This seems to have stopped working recently and I'm not sure what has changed.
return new Promise((resolve, reject) => {
base(tableName).select({
maxRecords: 100,
view: viewName
}).eachPage(function page(records, fetchNextPage) {
records.forEach(function(record) {
data.push({
----fields----
});
}); }
fetchNextPage();
}, function done(err) {
if (err) { console.error(err); return; }
resolve(data);
});
})
Apr 10, 2024 05:42 AM
Hello @Ruchika_Abbi1
Codes look the same as those given Airtable API instructions.
Just cross-check and check a couple of things to verify errors.
The first common thing is to check how many records are there.
Airtable has recently upgraded its API authentication from an Older use Key to a Token(AuthCode). Just cross-check you use Token with proper permissions.
If it's only paging related issue then see this section on your API reference What are the error codes you get?
👍
Apr 10, 2024 05:57 AM
Looks like I had to remove the following.
maxRecords: 100
Apr 10, 2024 06:14 AM
I don't think that's maxRecords option matters when you've more than 100 records.
Try that. 🤞