SQLITE_ERROR: near "ilike": syntax error

I've currently setup an my SQL query as follows:

export const getObservationsByUserId = async (
  db: LibSQLDatabase,
  uid: string,
  search?: string,
  page?: Pagination
): Promise<Observation[]> => {
  const { limit, offset } = page || { limit: 10, offset: 0 }

  const observationsForUserId = db.select().from(observations).where(eq(observations.owner, uid))

  if (search) {
    observationsForUserId.where(ilike(observations.name, `%${search}%`))
  }

  return await observationsForUserId.limit(limit).offset(offset).all()
}


However, I am seeing this error: SQLITE_ERROR: near "ilike": syntax error ... the search term is validated as a string, and I am using the %{search}% syntax, I'm wondering if this is a bug or is there something quirky I need to do to get ilike to work? (I've imported) ...
Was this page helpful?