Airtable / airtable.js

Airtable javascript client
MIT License
1.98k stars 404 forks source link

0.11.6 crashes on node 18 #362

Closed alex-all3dp closed 1 year ago

alex-all3dp commented 1 year ago

After upgrading from 0.11.5 to 0.11.6 our application crashes on startup due to an error in the following line:

https://github.com/Airtable/airtable.js/blob/2d36eb64249a51e99cc7f2ea3dfb59cd3522a188/src/abort-controller.ts#L7

Stacktrace:

throw new TypeError("Failed to parse URL from " + input, { cause: err });
            ^

TypeError: Failed to parse URL from 
    at new Request (node:internal/deps/undici/undici:7004:19)
    at Object.<anonymous> (/Users/alex/Developer/craftcloud-core/node_modules/airtable/lib/abort-controller.js:8:22)
    ... 4 lines matching cause stack trace ...
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Function._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18) {
  [cause]: TypeError [ERR_INVALID_URL]: Invalid URL
      at new NodeError (node:internal/errors:399:5)
      at URL.onParseError (node:internal/url:566:9)
      at new URL (node:internal/url:646:5)
      at new Request (node:internal/deps/undici/undici:7002:25)
      at Object.<anonymous> (/Users/alex/Developer/craftcloud-core/node_modules/airtable/lib/abort-controller.js:8:22)
      at Module._compile (node:internal/modules/cjs/loader:1254:14)
      at Module._compile (/Users/alex/Developer/craftcloud-core/node_modules/pirates/lib/index.js:136:24)
      at node:internal/modules/cjs/loader:1308:10
      at Object.newLoader [as .js] (/Users/alex/Developer/craftcloud-core/node_modules/pirates/lib/index.js:141:7)
      at Module.load (node:internal/modules/cjs/loader:1117:32) {
    input: '',
    code: 'ERR_INVALID_URL'
  }
}

Adding a valid URL to the Request seems to fix it on my end.

dbagley1 commented 1 year ago

Fixing this bug should be high priority because it makes the JavaScript library unusable without modifying the package.

This would also close #351 and #242. The invalid URL in the Request constructor is causing an error to be thrown in Node, Deno, and Cloudflare Workers. new Request('') with an empty string works in the browser because it uses the URL of the current page as a fallback.

NabeelFarooqui-at commented 1 year ago

Thanks for flagging this! v0.12.2 includes this fix.