Help

Cannot read property 'offset' of undefined

Topic Labels: API
2820 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Tobi_S
4 - Data Explorer
4 - Data Explorer

Hi,
I am trying to load all rows of a base. The code I use is:

const airbase = airtable.base('XXXXXXXX').table('someTable')
await airbase.select({offset: 0}).eachPage((records, processNextPage) => {
  records.forEach(record => console.log(record.get('someField')))
  processNextPage();
});

I get this error below after 3 records have been printed on the console. I tried to add query parameters (maxRecords: 1000, pageSize: 100), but the result is always the same: 3 records are printed.
When I set the pageSize to 1 I see that three records are printed as well (multiple pages are loaded, I assume), before it crashes with the same error.

    at /project/node_modules/airtable/lib/query.js:109:28
    at /project/node_modules/airtable/lib/run_action.js:70:17
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:58112) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

See excerpt from my yarn.lock

airtable@^0.10.0:
  version "0.10.0"
  resolved "https://registry.yarnpkg.com/airtable/-/airtable-0.10.0.tgz#29f7f5fb209b898b72238fe847142cf2a41210b2"
  integrity sha512-6gBUG+z1kqvwyHYWlc+y74TfYpc18mvmNuVcefjlvd6MSgLP9Hk47ByyBS6Ke8zdSk6kBTDpdiwCjoJQUpu6yg==
  dependencies:
    "@types/node" "^14.0.14"
    abort-controller "^3.0.0"
    abortcontroller-polyfill "^1.4.0"
    lodash "4.17.19"
    node-fetch "^2.6.0"

Thanks in advance,
Best regards
Tobi

0 Replies 0