-
Notifications
You must be signed in to change notification settings - Fork 403
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
AbortController issue #204
Comments
Not me! But I might be able to help with more information.
|
I've also been getting this error after trying to upgrade to airtable 0.9.0 Glad I'm not the only one. For a long time now I've been using airtable.js in my Netlify lambda functions, but upgrading to 0.9.0 has broken it without a resolution that I can find. If I go back to 0.8.1 it works fine, so there seems to be something going on with the recent move to The Node version is 10.21.0. Here's the full stack, though I'm not sure it's particularly helpful:
A minimal test case would probably involve setting up a super basic Netlify lambda environment with the following single function: var Airtable = require('airtable');
var base = new Airtable({ apiKey: '<my key>' }).base('<my base>');
exports.handler = async function (event, context) {
base('<table name>')
.select({
// Selecting the first 3 records in Grid view:
maxRecords: 3,
view: 'Grid view'
})
.eachPage(
function page(records, fetchNextPage) {
// This function (`page`) will get called for each page of records.
records.forEach(function (record) {
console.log('Retrieved', record.get('title'));
});
// To fetch the next page of records, call `fetchNextPage`.
// If there are more records, `page` will get called again.
// If there are no more records, `done` will get called.
fetchNextPage();
},
function done(err) {
if (err) {
console.error(err);
return;
}
}
);
}; |
Given the error name, it looks like this points to line 46 in var controller = new AbortController(); While I haven't gotten a working solution yet, playing around with it a bit is seems like the issue is related to the switch from I also opened #205 which could be pointing to the same/similar issue, but could also be Jest-specific instead of a problem related to Airtable.js. |
@Aias Version 0.9.0 works for me using Netlify's CLI for local testing and Node.js version 10.21.0. There may be subtle differences in the production environment, but there are other causes that could explain this. For starters: is |
@reelmatt Jest users should be able to upgrade to version 0.9.0 by installing the Here's a quick demo:
This may be the long-term solution because Jest uses JSDom, and JSDom is not supported by airtable.js. |
Hey @jugglinmike – |
@Aias It's Looking deeper, I'm also curious about how airtable.js is being imported. The minimal test case uses Node.js's Do you know where |
@jugglinmike Ah sorry there's some confusion here, that's my fault. On the window.global vs. global.window thing, I think I just miswrote the order before - in any case it doesn't matter, it's undefined either way.
|
If you have a repository that works with airtable 0.9.0 and that minimal netlify test case, I'd be happy to clone it and see if it runs on my machine. |
Sure. Here's a repository using that same code: https://github.com/bocoup/airtablejs-netlify-demo When I change the values according to my account and Airtable Base schema, the lambda function development environment prints data from the Base as anticipated. That may be a dead end, though, because the error stack trace above indicates that |
Thanks for all your help. Your example repo works. I was using the outdated netlify-lambda repository which does some kind of webpack compilation as part of its build step (I don't really understand the specifics). But when I switched everything from ES6 to CommonJS in my local repo, things started working again. So I guess the moral is: drop dependency on |
Sounds like a plan to me! That build process appears to be modifying the environment, so it's effectively a new execution environment--just slightly different than the environments which Airtable explicitly supports. It doesn't seem feasible for this project's maintainers to ensure proper integration there (especially if it's considered outdated). So while I'm receptive to evidence in favor of reverting the latest release, your particular problem doesn't seem to qualify as a regression. We still don't know much about @akarale's situation, though... |
I'm getting this error as well. I'm using airtable via node and webpack. There seems to be an issue with the node imports: Line 1 in 3d0ffc9
and airtable.js/lib/abort-controller.js Line 3 in 3d0ffc9
In each case, the require refers the the module, rather than the function / class respectively. |
Temporary workaround:
Create
and modify your build script in
|
We're also experiencing the same error ( Here is more information: Environment:
global.window is not defined at runtime, as it's a pure node app. Stacktrace:
After investigating more, the error occurs in // AbortController in my bundled node app is the following:
/*
Object [Module] {
AbortController: [Getter],
AbortSignal: [Getter],
default: [Function: AbortController]
}
*/
var controller = new AbortController(); // throws AbortController is not a constructor Workaround: Downgrade to airtable.js 0.8.1. |
any updates on this? |
I believe this is fixed as of ^0.10.1. I've been using the latest version without issue. |
Hi, I'm getting the same issue on 0.11.1. I am trying to use Airtable on Nest.js btw.
any help would be appreciated, thanks! |
try the new node-fetch version 3, e.g. yarn add [email protected]. then remove the node_modules/airtable/node_modules |
I'm running into this issue now with airtable v0.11.4 I have It would be great if the dependency was updated |
Any update on this issue? I have been working on this |
My Workaround: Hosting my own node-fetch 2.6.7 and airtable, changing airtable's dependency to my own node-fetch and delete that few lines on node-fetch that caused error. |
I am able to get around the problem by using node compact mode on the wrangler. importing doesn't work so you can only include them internally which has some severe tradeoffs to include the modules you need to add this line to your wrangler.toml file but doing so has the following tradeoffs ‡ default export only, because it's console, seriously just use the global § vm does not have all corner cases and has less of them in a web worker ∆ not shimmed, just returns mock |
The issue has been open since Aug 6, 2020, please fix issue with that node-fetch package. |
This should be fixed by our latest release, v0.11.6 |
It is not. |
Hey @maxcan, sorry this is still happening for you! Can you share more about the environment where this error is coming up? Is it in a browser, on a server, in a web worker, etc? This error happens because we have a polyfill for environments that have |
Hey @BridgerMaxwell-at, I'm getting error on AWS Lambda Functions, I'm using Serverless Framework 3.*, it worked fine locally with the "serverless-offline" plugin, right now I'm using "[email protected]" it has no error |
It still not work in Node.js 18 in AWS Lambda with version
"airtable": "0.12.1"
},
"overrides": {
"airtable": {
"node-fetch": "^3.3.1"
}
} |
Worked for me - Next.js 14, Airtable 0.12.2
|
Working for me in Next 14: #386 (comment) |
TypeError: AbortController is not a constructor
Anyone else getting this error? How did you resolve it?
The text was updated successfully, but these errors were encountered: