kintone/js-sdk

Avoid the error caused by cursor limitation after execution of `getAllRecords`

Closed this issue · 1 comments

Package

  • @kintone/rest-api-client

Why

fix kintone/js-sdk-ja#26

What

In getAllRecords, call DELETE /cursor.json after fetching records with cursor.json.

A cursor is deleted automatically when all records are obtained from an existing cursor.

The maximum valid cursors per domain is 10.
If this limit is reached, API calls to add new cursors will fail.
If one of the following actions occur, the number of valid cursors will be reduced:

  • All records are obtained from an existing cursor
  • A valid cursor is deleted
  • A valid cursor expires

https://kintone.dev/en/docs/kintone/rest-api/records/add-cursor/#limitations

getAllRecords() fetches all records, so the cursor should have been deleted in a normal case.

If an error is thrown, getAllRecords() call delete cursor API in the catch block.

await this.deleteCursor({ id });