supabase / edge-runtime

A server based on Deno runtime, capable of running JavaScript, TypeScript, and WASM services.
MIT License
639 stars 55 forks source link

Cannot find module 'worker_threads' #394

Closed Cteq3132 closed 3 weeks ago

Cteq3132 commented 1 month ago

Bug report

Describe the bug

When using unzipit from npm, the function won't boot with the following error : event loop error: Error: Cannot find module 'worker_threads'. Everything work fine with the local environment of Supabase.

To Reproduce

  1. Create a function
  2. Add the dependency to unzipit : import { unzip } from "npm:unzipit";
  3. Deploy to supabase

Expected behavior

The function boots

Screenshots

ø

System information

Additional context

The error in the function logs:

{
  "event_message": "event loop error: Error: Cannot find module 'worker_threads'\nRequire stack:\n- /tmp/sb-compile-edge-runtime/node_modules/localhost/unzipit/1.4.3/dist/unzipit.js\n- /tmp/sb-compile-edge-runtime/node_modules/localhost/unzipit/1.4.3/dist/unzipit.js\n    at Module._resolveFilename (node:module:562:15)\n    at Module._load (node:module:449:27)\n    at Module.require (node:module:607:19)\n    at dynamicRequire (file:///tmp/sb-compile-edge-runtime/node_modules/localhost/unzipit/1.4.3/dist/unzipit.js:433:30)\n    at file:///tmp/sb-compile-edge-runtime/node_modules/localhost/unzipit/1.4.3/dist/unzipit.js:439:24\n    at file:///tmp/sb-compile-edge-runtime/node_modules/localhost/unzipit/1.4.3/dist/unzipit.js:505:4\n    at file:///tmp/sb-compile-edge-runtime/node_modules/localhost/unzipit/1.4.3/dist/unzipit.js:3:66\n    at Object.<anonymous> (file:///tmp/sb-compile-edge-runtime/node_modules/localhost/unzipit/1.4.3/dist/unzipit.js:6:2)\n    at Object.<anonymous> (file:///tmp/sb-compile-edge-runtime/node_modules/localhost/unzipit/1.4.3/dist/unzipit.js:1204:4)\n    at Module._compile (node:module:657:34)",
  "id": "...",
  "metadata": [
    {
      "boot_time": null,
      "cpu_time_used": null,
      "deployment_id": "...",
      "event_type": "UncaughtException",
      "execution_id": "...",
      "function_id": "...",
      "level": "error",
      "memory_used": [],
      "project_ref": "...",
      "reason": null,
      "region": "eu-west-3",
      "served_by": "supabase-edge-runtime-1.54.10 (compatible with Deno v1.43.0)",
      "timestamp": "2024-07-30T13:03:06.111Z",
      "version": "143"
    }
  ],
  "timestamp": 1722344586486073
}
nyannyacha commented 1 month ago

Hello @Cteq3132 😁

This is a known bug and we'll fix it together in the next Deno version up PR. Thanks for reporting!

Cteq3132 commented 1 month ago

Great, thanks for the quick reply! Do you know approximately when the PR will be merged?

DevChanQ commented 1 month ago

Facing the same problem here. Are there any quick patches to make this work before the PR's merged?

github-actions[bot] commented 3 weeks ago

:tada: This issue has been resolved in version 1.57.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

codinronan commented 2 weeks ago

Just adding a comment here, the module has not been stubbed the functions have been filled with notImplemented which throws.

So if you need code to not crash when you create things, even if it's ok if the module doesn't do what you intended, it won't work. It will still crash.

Will wait for the module to really come back... some day...

Thanks for keeping up with it though guys!