Skip to main content

Hi there, I"m new to Airtable and I keep seeing this “Invalid Filter By Formula” error.


I’m not sure what parts went wrong but this is my code:


Are there other methods to get a single user ?


THANK YOU for your help !


THE CODE


export const findUserByEmail = async (userEmail) => {
const userRecord = await table
.select({
filterByFormula: `user_email=${userEmail}`,
})
.firstPage();

if (userRecord.length !== 0) {
return userRecordR0].fields;
}
};


The ERROR


AirtableError {
error: 'INVALID_FILTER_BY_FORMULA',
message: 'The formula for filtering records is invalid: Invalid formula. Please check your formula text.',
statusCode: 422
}

My temporary workaround solution is to use JavaScript filter method - probably not ideal but I haven’t figured out other solutions yet.

e.g.


const allUsers = await table.select().all();
const filterUser = allUsers.filter(
(user) => user.fields.user_email === userEmail
);

Try wrapping ${userEmail} in quotes.


`user_email="${userEmail}"`

Try wrapping ${userEmail} in quotes.


`user_email="${userEmail}"`

AHHH yes, that works! Thank you!


Reply