Sharding with Deno

Does ShardingManager with mode: "worker" even work in Deno? I keep getting this error, which I'm guessing comes from how Deno polyfills node:worker_threads. But, mode: "process" works fine, just uses too much ram. Compatibility? I didn't find a related issue on GitHub, so maybe I'm missing something...
No description
17 Replies
d.js toolkit
d.js toolkit3mo ago
monbrey
monbrey3mo ago
We don't specifically test for Deno or Bun compatibility to my knowledge
Miran
Miran3mo ago
why are you prefer deno over node.js?
Shizuka
ShizukaOP3mo ago
Node.js fails in every aspect compared to other runtimes; slower startups, high memory usage, heavier tooling ecosystem, and you need external tools for literally everything I was originally going with Bun for the most part, but recently decided to give Deno a try
Miran
Miran3mo ago
to be honest I've done a bunch of projects but never had an issue with any of the stuff you're talking about
Shizuka
ShizukaOP3mo ago
It's not exactly an "issue", but rather a focus on development experience
Miran
Miran3mo ago
I haven't had any problems with Node.js so far, so I don't have any knowledge or experience with Deno. But from what I've seen, some things that work in Node.js might not work or could cause errors in Deno. Considering that, it seems like the cons are a much bigger loss than the pros. It looks like an issue as you're created this thread. It's not great that Deno is causing you problems like this when you're using it to improve your development experience
Shizuka
ShizukaOP3mo ago
From what I've seen so far, Deno has many points where it's behind, but that doesn't mean the cons are a much bigger loss. It has a really good ecosystem with workspaces, and being Typescript-first, it really helps a lot. That said, you should see the performance comparisons. Of course, if you don't find that a problem, you really shouldn't change. I like having my tools built-in; like linters, formatters, test runners, and bundlers. Instead of having to install a hundred packages and dependencies for each step
materwelon
materwelon3mo ago
in my opinion libraries that use specific node features, like worker threads, really should be used with node. Deno is great but you're trying to fight the runtime here. And node is definitely not bad. If it was, so many libraries, frameworks, systems etc wouldn't be using it.
Shizuka
ShizukaOP3mo ago
Of course, I'm not saying node is bad; I'm just saying why I prefer other runtimes.
Shizuka
ShizukaOP3mo ago
Anyways, I found a walkaround for my problem, it was by commenting this line in Shard.js:
No description
Shizuka
ShizukaOP3mo ago
Kind of a sloppy solution, but I'll go with it for now
materwelon
materwelon3mo ago
did you edit the file in node_modules? side note: that SHARE_ENV caused issues in bun too. they fixed it a few weeks ago
Shizuka
ShizukaOP3mo ago
Yeah, but I can just fork the repo and edit it
materwelon
materwelon3mo ago
hm
Shizuka
ShizukaOP3mo ago
Thats great, I had problems with it before too

Did you find this page helpful?