framework icon indicating copy to clipboard operation
framework copied to clipboard

cdn.jsdelivr.net can time out on some modules, triggering an uncaught error

Open Fil opened this issue 1 year ago • 1 comments
trafficstars

With a page that contains:

```js echo
const Cite = import("npm:citation-js");
```

loading the modules ends up in a breaking timeout (showing "fetch failed" on the page) on https://cdn.jsdelivr.net/npm/@citation-js/[email protected]/+esm (which also fails if you try to open it independently of framework). In the log we see:

npm:@citation-js/[email protected]/+esm → src/.observablehq/cache/_npm/@citation-js/[email protected]/_esm.js
TypeError: fetch failed
    at node:internal/deps/undici/undici:12442:11
    …

I initially thought this was a fluke, but trying to install the same module locally (yarn add citation-js) I see this warning:

warning citation-js > @citation-js/plugin-wikidata > [email protected]: wikidata-sdk has been renamed wikibase-sdk

which might be the root cause.

Should our npm: resolver do some work to detect a rename? Should we catch this error? Should we just leave this as is? — it seems possible to load citation-js with: import("npm:@citation-js/core");

Fil avatar May 15 '24 07:05 Fil

Should our npm: resolver do some work to detect a rename?

No, what you saw is a deprecation warning. There isn’t a formal concept of a rename and it wouldn’t be safe or reliable to try to parse deprecation warnings for renames.

mbostock avatar May 15 '24 12:05 mbostock

Don’t think there’s anything we can do here.

mbostock avatar Jun 12 '24 16:06 mbostock