Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sporadic 'Cannot read properties of undefined (reading 'id')' errors #379

Open
domdomegg opened this issue Aug 1, 2023 · 0 comments
Open

Comments

@domdomegg
Copy link

Rarely, when retrieving some records we get the error:

TypeError: Cannot read properties of undefined (reading 'id')
    at new Record (/var/task/node_modules/airtable/lib/record.js:20:42)
    at Table._findRecordById (/var/task/node_modules/airtable/lib/table.js:43:22)
    at /var/task/node_modules/airtable/lib/callback_to_promise.js:48:20
    at new Promise (<anonymous>)
    at Table.find (/var/task/node_modules/airtable/lib/callback_to_promise.js:39:20)

From the code, this appears to correspond to this line:

this.id = recordId || recordJson.id;

Which is called here:

const record = new Record(this, recordId);

And exposed as table.find here:

this.find = callbackToPromise(this._findRecordById, this);

So maybe it's possible for an undefined recordId to be passed in, which blows up when we try to construct a record?

(this may be user error in terms of passing in an undefined record id - but even in that case I think we could put in a better error here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant