Mulo
Mulo
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
well it seems like doing the oldest trick in the book - aka rebooting - might have alleviate the issue. Tho I guess is common to have unknown interaction here and there for everybody (hopefully). But when installing couple of debugging tools they erased the node modules folder and messed up something that next.js is not able to build websites, how nice.
67 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
btw sidenote, i tried pinging discord with traceroute and it seems the connection is not direct as one might think as in there actually wouldnt be much difference between having a bot in north america and europe
67 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
i was with ovh in eu w/o much problems, now stil ovh in canada
67 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
that's assuring 😄
67 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
or to have these issues, it should rather be sync ops issue
67 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
as in any async process
67 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
can promises be realistically the problem?
67 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
const blocked = require('blocked-at');
blocked((time, stack) => {
console.log(`Blocked for ${time}ms, operation started here:`, stack);
}, { threshold: 50 }); // Logs if event loop is blocked > 50ms
const blocked = require('blocked-at');
blocked((time, stack) => {
console.log(`Blocked for ${time}ms, operation started here:`, stack);
}, { threshold: 50 }); // Logs if event loop is blocked > 50ms
also rarely getting this, and not when getting unknwon interaction
67 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
No description
67 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
also:
setInterval(() => {
const currentTime = process.hrtime(lastTime);
const delay = currentTime[0] * 1e3 + currentTime[1] / 1e6;

if (delay > 1050) { // Log if the delay exceeds 100 ms (adjust threshold as needed)
console.log('Event Loop Delay:', delay, 'ms');
}

lastTime = process.hrtime();
}, 1000);
setInterval(() => {
const currentTime = process.hrtime(lastTime);
const delay = currentTime[0] * 1e3 + currentTime[1] / 1e6;

if (delay > 1050) { // Log if the delay exceeds 100 ms (adjust threshold as needed)
console.log('Event Loop Delay:', delay, 'ms');
}

lastTime = process.hrtime();
}, 1000);
im barely getting a log, if not only on reboot
67 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
try {
await interaction.deferReply()
} catch (error) {
const memoryUsage = process.memoryUsage();
console.log(`Heap Used: ${(memoryUsage.heapUsed / 1024 / 1024).toFixed(2)} MB`);
console.log(`Heap Total: ${(memoryUsage.heapTotal / 1024 / 1024).toFixed(2)} MB`);
try {
await interaction.deferReply()
} catch (error) {
const memoryUsage = process.memoryUsage();
console.log(`Heap Used: ${(memoryUsage.heapUsed / 1024 / 1024).toFixed(2)} MB`);
console.log(`Heap Total: ${(memoryUsage.heapTotal / 1024 / 1024).toFixed(2)} MB`);
Heap Used: 188.32 MB
Heap Total: 193.33 MB
Heap Used: 188.32 MB
Heap Total: 193.33 MB
is this a concen?
67 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
and 2 websites
67 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
just 2 (one sharded) the other normal (it's in 300 servers)
67 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
i have 1Gbps, as the graph supposedly say im way below it
67 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
the other bot file? no, same machine
67 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
im using discord.js@14.16.3 btw
67 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
im noticing im getting unknown interaction on another bot im running as well, which is not sharded
67 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
No description
67 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
const fetch = require('node-fetch');

async function manuallyDefer(interaction) {
const url = `https://discord.com/api/v10/interactions/${interaction.id}/${interaction.token}/callback`;

const body = {
type: 5 // DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE
};

const start = Date.now();
console.log(`[${interaction.id}] Sending raw deferReply at ${start}`);

try {
const res = await fetch(url, {
method: 'POST',
headers: {
'Authorization': `Bot ${process.env.BOT_TOKEN}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(body)
});

const end = Date.now();
console.log(`[${interaction.id}] Response from deferReply in ${end - start}ms`);

if (!res.ok) {
const errText = await res.text();
console.error(`[${interaction.id}] Defer failed: ${res.status} - ${errText}`);
}
} catch (error) {
console.error(`[${interaction.id}] Defer error:`, error);
}
}
const fetch = require('node-fetch');

async function manuallyDefer(interaction) {
const url = `https://discord.com/api/v10/interactions/${interaction.id}/${interaction.token}/callback`;

const body = {
type: 5 // DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE
};

const start = Date.now();
console.log(`[${interaction.id}] Sending raw deferReply at ${start}`);

try {
const res = await fetch(url, {
method: 'POST',
headers: {
'Authorization': `Bot ${process.env.BOT_TOKEN}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(body)
});

const end = Date.now();
console.log(`[${interaction.id}] Response from deferReply in ${end - start}ms`);

if (!res.ok) {
const errText = await res.text();
console.error(`[${interaction.id}] Defer failed: ${res.status} - ${errText}`);
}
} catch (error) {
console.error(`[${interaction.id}] Defer error:`, error);
}
}
Should I try this to manually debug the issue
67 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 4/8/2025 in #djs-questions
Started sharding: a lot of `unknown interactions`
right but if the cause of this were whatever internal long running sync op, I would be seeing issues on both send/ receive. Since this is not the case, im out of options beside external server provider issues
67 replies