Airtable / airtable.js

Airtable javascript client
MIT License
1.97k stars 401 forks source link

TypeError: abort_controller_1.default is not a constructor #323

Open Cargoer opened 2 years ago

Cargoer commented 2 years ago

Hi, I try to use airtable to create an application running in wechat miniprogram through uni-app, but when I request data in airtable, I get an error said TypeError: abort_controller_1.default is not a constructor, This doesn't happen in web. My code is following:

// airtable.js
export default class Table {
  constructor(apiKey, baseKey, table) {
    this.table = (new Airtable({apiKey}).base(baseKey))(table)
    console.log("constructor done!")
  }

  // request for airtable data
  getRecords(filterFormula = "") {
    return new Promise((resolve, reject) => {
      let recordList = []
      this.table
        .select({
          view: "Grid view",
          filterByFormula: filterFormula,
        })
        .eachPage(function Page(records, fetchNextPage) {
          recordList = [...recordList, ...records.map(item => item.fields)]
          fetchNextPage()
        }, function done(err) {
          err? reject(err): resolve(recordList)
        })
    })
  }
}

// main.js (using)
let recordsTable = new Table(apiKey, baseKey, recordsTableName)
recordsTable.getRecords(filterFormula)
      .then(records => {
        this.setRecords(records)
      })
      .catch(err => {
        console.error("get records err:", err)
      })

I want to know why this error exists

dattm97 commented 1 year ago

I have same issue. Does Airtable supports React Native?

myko1328 commented 1 year ago

I have similar issue. Just by calling table.select({}).firstPage(); gives me an error: TypeError: c.default is not a constructor

I would really appreciate if someone can enlighten us with the issue. thanks!

dattm97 commented 1 year ago

@rmeritz Hi Meritz, can you help us with this issue?

sergiobarria commented 1 year ago

Same issue here. Everything works with curl but when I try table.select() or similar, it throws the following error: [TypeError: abort_controller_1.default is not a constructor]

dev99problems commented 1 year ago

Can confirm the same behaviour, while trying to use Airtable npm package in Cloudflare Workers.

bridger commented 1 year ago

This should be fixed by our latest release, v0.11.6

https://github.com/Airtable/airtable.js/commit/b468d8fe48d75e3d5fe46d0ea7770f4658951ed0