Cannot find module 'worker_threads'
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
- Create a function
- Add the dependency to unzipit :
import { unzip } from "npm:unzipit"; - 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
}
Hello @Cteq3132 😁
This is a known bug and we'll fix it together in the next Deno version up PR. Thanks for reporting!
Great, thanks for the quick reply! Do you know approximately when the PR will be merged?
Facing the same problem here. Are there any quick patches to make this work before the PR's merged?
: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:
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!