-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Node.js version: 20.14.0
OS version: Windows 11 Pro 23H2
Description: The discord.js client cannot be passed through workerData. I have to do this, because I need it in my jobs.
Actual behavior
It should pass the discord.js client so I can use it in my jobs.
Expected behavior
I receive the following error:
node:internal/per_context/domexception:53
ErrorCaptureStackTrace(this);
^
DOMException [DataCloneError]: (_, shardId) => {
for (const [guildId, adapter] of this.adapters.entries()) {
if (client.guilds.c...<omitted>... } could not be cloned.
at new DOMException (node:internal/per_context/domexception:53:5)
at new Worker (node:internal/worker:266:17)
at Bree.createWorker (C:\Users\seir\Documents\GitHub\SMERSH\node_modules\bree\src\index.js:764:12)
at Bree.run (C:\Users\seir\Documents\GitHub\SMERSH\node_modules\bree\src\index.js:384:35)
at C:\Users\seir\Documents\GitHub\SMERSH\node_modules\bree\src\index.js:605:18
at Timeout.fireNow (C:\Users\seir\Documents\GitHub\SMERSH\node_modules\safe-timers\index.js:36:10)
at Timeout.fired (C:\Users\seir\Documents\GitHub\SMERSH\node_modules\safe-timers\index.js:25:11)
at listOnTimeout (node:internal/timers:575:11)
at process.processTimers (node:internal/timers:514:7)
Code to reproduce
// index.js
import Bree from 'bree';
import { Client, GatewayIntentBits } from 'discord.js';
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
const bree = new Bree({
jobs: [
{
name: 'test',
worker: { workerData: { client } }
}
]
});
await bree.start();
// jobs/test.js
console.log('Test');Checklist
- I have searched through GitHub issues for similar issues.
- I have completely read through the README and documentation.
- I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working