Airtable sometimes return results and sometimes not

Topic Labels: API
2632 2
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer

I am using Node.js library to communicate with AirTable, official js library. I am having a problem with filterByFormula. Sometimes when I try to find a record in AirTable I don’t get results even though I am pretty sure that there should be some results. My logic is such that if I do not find the record in AirTable I create a new one. If I find it I update an existing one. This logic leads to problem with same entries entered twice.

This is my query:

getReservationByID: async (externalID) {
    let reservations = await calendarBase('Reservations').select({
      view: 'Main View',
      filterByFormula: `{External ID} = \"${externalID}\"`,
      maxRecords: 1,

    return (reservations.length > 0) ? reservations[0] : null;

And this function is used like this:

let oldReservation = await getReservationByID(;
if (!oldReservation) {
} else {

As you can see, it is essential for me to get record from AirTable if it exists, but sometimes AirTable is not returning an existing record with given ID and then I get duplicate with same external ID. Am I doing something wrong or is there some issue that I am not aware of?

2 Replies 2
6 - Interface Innovator
6 - Interface Innovator

Try doing it without specifying a view. If no view is included, Airtable will search all records in the table which match your formula. If you specify the view, Airtable will limit its search to just that view and then find all records that match your formula. If you have a filter on the “Main View,” then you may be hiding certain records from your script.

Otherwise, your code looks fine to me. Another option is that you have a bug with and the value isn’t always what you expect which is then impacting your filterByFormula.

I’ve implemented what you have suggested. So far so good. Today I didn’t have any duplicates.

Thank you.