edge-runtime icon indicating copy to clipboard operation
edge-runtime copied to clipboard

Cannot find module 'worker_threads'

Open Cteq3132 opened this issue 7 months ago • 3 comments

Bug report

  • [x] I confirm this is a bug with Supabase, not with my own application.
  • [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.

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

  • OS: macOS
  • Browser (if applies) [e.g. chrome, safari]
  • Version of supabase-js: [e.g. 6.0.2]
  • Version of Node.js: [e.g. 10.10.0]

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
}

Cteq3132 avatar Jul 30 '24 14:07 Cteq3132