Skip to content
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

JSDelivr can't find .wasm file (but the esm.sh CDN works fine) #18561

Open
3 tasks done
josephrocca opened this issue Apr 8, 2024 · 0 comments
Open
3 tasks done

JSDelivr can't find .wasm file (but the esm.sh CDN works fine) #18561

josephrocca opened this issue Apr 8, 2024 · 0 comments

Comments

@josephrocca
Copy link

josephrocca commented Apr 8, 2024

Description

This doesn't work because it can't find the wasm files of a dependency:

let { getQuickJS, shouldInterruptAfterDeadline } = await import('https://cdn.jsdelivr.net/npm/quickjs-emscripten@0.29.1/+esm');
let QuickJS = await getQuickJS()
const result = QuickJS.evalCode("1 + 1", {
  shouldInterrupt: shouldInterruptAfterDeadline(Date.now() + 20),
  memoryLimitBytes: 1024 * 1024,
})
console.log(result);

image

GET https://cdn.jsdelivr.net/npm/@jitl/quickjs-wasmfile-release-sync@0.29.1/emscripten-module/emscripten-module.wasm 404
+esm:7 wasm streaming compile failed: TypeError: Failed to execute 'compile' on 'WebAssembly': HTTP status code is not ok
+esm:7 falling back to ArrayBuffer instantiation
GET https://cdn.jsdelivr.net/npm/@jitl/quickjs-wasmfile-release-sync@0.29.1/emscripten-module/emscripten-module.wasm 404 (Not Found)
+esm:7 failed to asynchronously prepare wasm: both async and sync fetching of the wasm failed
+esm:7 Aborted(both async and sync fetching of the wasm failed)
+esm:8 Uncaught RuntimeError: Aborted(both async and sync fetching of the wasm failed). Build with -sASSERTIONS for more info.
    at M (+esm:7:1567)
    at +esm:7:2390

But esm.sh works fine:

let { getQuickJS, shouldInterruptAfterDeadline } = await import('https://esm.sh/quickjs-emscripten@0.29.1');
// ...

Affected jsDelivr links

https://cdn.jsdelivr.net/npm/quickjs-emscripten@0.29.1/+esm

Response headers

Accept-Ranges: bytes
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: *
Age: 617
Alt-Svc: h3=":443";ma=86400,h3-29=":443";ma=86400,h3-27=":443";ma=86400
Cache-Control: public, max-age=31536000, s-maxage=31536000, immutable
Content-Encoding: br
Content-Length: 703
Content-Type: application/javascript; charset=utf-8
Cross-Origin-Resource-Policy: cross-origin
Date: Mon, 08 Apr 2024 03:44:13 GMT
Etag: W/"617-Jck2+2fk0QKnX+ZtJRbyk/YgBEw"
Link: </npm/quickjs-emscripten-core@0.29.1/+esm>; rel="modulepreload"; nopush, </npm/@jitl/quickjs-wasmfile-debug-sync@0.29.1/+esm>; rel="modulepreload"; nopush, </npm/@jitl/quickjs-wasmfile-release-sync@0.29.1/+esm>; rel="modulepreload"; nopush, </npm/@jitl/quickjs-wasmfile-debug-asyncify@0.29.1/+esm>; rel="modulepreload"; nopush, </npm/@jitl/quickjs-wasmfile-release-asyncify@0.29.1/+esm>; rel="modulepreload"; nopush
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Timing-Allow-Origin: *
Vary: Accept-Encoding
X-Cache: MISS, HIT
X-Content-Type-Options: nosniff
X-Jsd-Version: 0.29.1
X-Jsd-Version-Type: version
X-Served-By: cache-fra-eddf8230140-FRA, cache-qpg1225-QPG

Information

  • Device OS: Ubuntu 22.04
  • Browser & Version: Chrome 122

Requisites

  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue.
  • I checked the documentation to understand that the issue I am reporting is not normal behavior.
  • I understand that not filling out this template correctly will lead to the issue being closed.

Additional content

I'm not sure if this is expected behavior, but I've noticed this wasm-related problem with JSDelivr several times (not just for this QuickJS package), so I figured I'd report it.

Possibly related:

But note that the above link says unpkg works fine, whereas in the case of this QuickJS package, unpkg does not work - it has the same problem as JSDelivr.

This comment by the author of this package, @justjake, explicitly says that esm.sh is supported. Perhaps Jake can drop a comment on the specific issue with JSDelivr (apologies for the ping if not!) to help the JSDelivr assess whether this issue is within-scope, or something that package authors will have to work around if they want JSDelivr to serve their package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant