Zombie Connection

I get zombie connection error and bot doesnt even startup, had this issue before but changed my hosting service Now it doesnt work on any hosting services
33 Replies
d.js toolkit
d.js toolkit7mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by staff
! Seferog
! Seferog7mo ago
@Qjuh Do you remember the error, last time I spoke to you
! Seferog
! Seferog7mo ago
No description
! Seferog
! Seferog7mo ago
it says fully ready then zombie connection whats the reason for zombie connection those are just catching unknown interactions
! Seferog
! Seferog7mo ago
No description
! Seferog
! Seferog7mo ago
bot ready => zombie connection I have no idea why it gets there everything looks fine fully ready, logged in then zombie connection out of nowhere @Qjuh
! Seferog
! Seferog7mo ago
No description
! Seferog
! Seferog7mo ago
zombie connection occurs when there is no ready event fired? before ready? just connects to database but shouldnt it continue after its marked fully ready same code was working 3hrs ago hmm let me try that it started working randomly now without pushing anything should I put that into ready? client.on("ready", async () => { console.log(Logged in as as ${client.user.tag}!); console.log(Bot is in ${client.guilds.cache.size} servers); mainLogs = client.channels.cache.get("1125854676995293224"); await startChecking(); }); ready is this rn I can add dbconnect above startchecking would that work
const mongoose = require('mongoose')
require('dotenv').config();

const { MONGOOSE } = process.env;
module.exports = async () => {
await mongoose.connect(MONGOOSE, {
useNewUrlParser: true,
useUnifiedTopology: true,
})
return mongoose
}
const mongoose = require('mongoose')
require('dotenv').config();

const { MONGOOSE } = process.env;
module.exports = async () => {
await mongoose.connect(MONGOOSE, {
useNewUrlParser: true,
useUnifiedTopology: true,
})
return mongoose
}
yes seems like its blocking but would this code block for that long so basicly zombie connection happens when bot is not ready in 41 secs? I do await mongo btw its working now when I changed the hosting lol this is so weird first it stopped working on my local then stopped working on render next time it will stop working on heroku 🥲 @Qjuh then who would help me pepehm it stops working randomly like I said next time it will stop working on heroku then I am basicly fucked yeah but once it stops working on any platform it doesnt work anymore doubt that ethernet issue no okay so basicly zombie connection is when heartbeat is not received right? what exactly receives the heartbeat maybe I can focus on that yeah but it worked flawless for 1.5 months then some day it stopped working even with older commits I saw something about compilation on one of threads hmm so mongodb can block my ip? or might have blocked yup yup thats allowed access from anywhere
! Seferog
! Seferog7mo ago
No description
! Seferog
! Seferog7mo ago
let me try running it without any db connection on my local
const {
Client,
Collection,

GatewayIntentBits,

Partials,
} = require("discord.js");
const fs = require("fs");
const { LimitedCollection } = require("discord.js");
const thingsToDefaultCache = [
"GuildChannelManager",
"PermissionOverwriteManager",
"RoleManager",
"GuildManager",
"ChannelManager",
];
const client = new Client({
waitGuildTimeout: 1000 * 60 * 60,
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMembers,
],
partials: [
Partials.Message,
Partials.Channel,
Partials.Reaction,
Partials.GuildMember,
Partials.User,
],
makeCache: (manager) => {
if (thingsToDefaultCache.includes(manager.name)) {
return new Collection();
}
return new LimitedCollection({
maxSize: 0,
});
},
});
const testMode = false;

client.commands = new Collection();
const commandFiles = fs
.readdirSync("./commands/")
.filter((file) => file.endsWith(".js"));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.data.name, command);
}

client.on("error", (error) => {
console.error("An error occurred:", error);
});

client.on("ready", async () => {
console.log(`Logged in as as ${client.user.tag}!`);
console.log(`Bot is in ${client.guilds.cache.size} servers`);
});
client.on("debug", (debug) => {
if (debug.includes("Heartbeat acknowledged")) return;
console.log(debug);
});
let hasCreated = false;
if (!hasCreated) {
hasCreated = true;
client.on("messageCreate", async (msg) => {
console.log(msg.author.id);
});
}

client.login(testMode ? process.env.TEST_TOKEN : process.env.BOT_TOKEN);
const {
Client,
Collection,

GatewayIntentBits,

Partials,
} = require("discord.js");
const fs = require("fs");
const { LimitedCollection } = require("discord.js");
const thingsToDefaultCache = [
"GuildChannelManager",
"PermissionOverwriteManager",
"RoleManager",
"GuildManager",
"ChannelManager",
];
const client = new Client({
waitGuildTimeout: 1000 * 60 * 60,
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMembers,
],
partials: [
Partials.Message,
Partials.Channel,
Partials.Reaction,
Partials.GuildMember,
Partials.User,
],
makeCache: (manager) => {
if (thingsToDefaultCache.includes(manager.name)) {
return new Collection();
}
return new LimitedCollection({
maxSize: 0,
});
},
});
const testMode = false;

client.commands = new Collection();
const commandFiles = fs
.readdirSync("./commands/")
.filter((file) => file.endsWith(".js"));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.data.name, command);
}

client.on("error", (error) => {
console.error("An error occurred:", error);
});

client.on("ready", async () => {
console.log(`Logged in as as ${client.user.tag}!`);
console.log(`Bot is in ${client.guilds.cache.size} servers`);
});
client.on("debug", (debug) => {
if (debug.includes("Heartbeat acknowledged")) return;
console.log(debug);
});
let hasCreated = false;
if (!hasCreated) {
hasCreated = true;
client.on("messageCreate", async (msg) => {
console.log(msg.author.id);
});
}

client.login(testMode ? process.env.TEST_TOKEN : process.env.BOT_TOKEN);
! Seferog
! Seferog7mo ago
No description
! Seferog
! Seferog7mo ago
code & terminal response was testing that 1sec some guy told me that fixed it for him
! Seferog
! Seferog7mo ago
No description
! Seferog
! Seferog7mo ago
rn it logs in but no console log here console .log(msg.author.id) and 608 unavailable guilds so I just receive events from available guilds right? why would it give unavailable guild count yes latest
! Seferog
! Seferog7mo ago
No description
! Seferog
! Seferog7mo ago
npm list
! Seferog
! Seferog7mo ago
No description
! Seferog
! Seferog7mo ago
on github I saw this how can I add it on 14.14.1 oh I am out of options 🥲
! Seferog
! Seferog7mo ago
No description
! Seferog
! Seferog7mo ago
No description
! Seferog
! Seferog7mo ago
675 logging it on when bot first is ready to not see those on logs idk let me change bot uses those
const { Client, GatewayIntentBits, Partials } = require("discord.js");
require("dotenv").config();
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMembers,
],
partials: [
Partials.Message,
Partials.Channel,
Partials.Reaction,
Partials.GuildMember,
Partials.User,
],
});
const testMode = false;

client.on("error", (error) => {
console.error("An error occurred:", error);
});

client.on("ready", async () => {
console.log(`Logged in as as ${client.user.tag}!`);
console.log(`Bot is in ${client.guilds.cache.size} servers`);
});
client.on("debug", (debug) => {
console.log(
`${new Date().getUTCHours()}:${new Date().getUTCMinutes()}:${new Date().getUTCSeconds()} || ${debug}`
);
});

client.on("messageCreate", async (msg) => {
console.log(msg.author.id);
});

client.login(testMode ? process.env.TEST_TOKEN : process.env.BOT_TOKEN);
const { Client, GatewayIntentBits, Partials } = require("discord.js");
require("dotenv").config();
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMembers,
],
partials: [
Partials.Message,
Partials.Channel,
Partials.Reaction,
Partials.GuildMember,
Partials.User,
],
});
const testMode = false;

client.on("error", (error) => {
console.error("An error occurred:", error);
});

client.on("ready", async () => {
console.log(`Logged in as as ${client.user.tag}!`);
console.log(`Bot is in ${client.guilds.cache.size} servers`);
});
client.on("debug", (debug) => {
console.log(
`${new Date().getUTCHours()}:${new Date().getUTCMinutes()}:${new Date().getUTCSeconds()} || ${debug}`
);
});

client.on("messageCreate", async (msg) => {
console.log(msg.author.id);
});

client.login(testMode ? process.env.TEST_TOKEN : process.env.BOT_TOKEN);
running with this code
! Seferog
! Seferog7mo ago
No description
! Seferog
! Seferog7mo ago
Probably idk it was working so I left it I think it doesnt receive any heartbeats right?
! Seferog
! Seferog7mo ago
No description
! Seferog
! Seferog7mo ago
I dont see any received yes but I have the same case on hosting services as well checking wait actually let me remove all partials etc just removed them in case
! Seferog
! Seferog7mo ago
No description
! Seferog
! Seferog7mo ago
okay now seems to be working but I couldnt see msg author ids come in but 1sec hmm okay okay with this code
const { Client, GatewayIntentBits, Partials } = require("discord.js");
require("dotenv").config();
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
],
partials: [
Partials.Message,
Partials.Channel,
Partials.Reaction,
Partials.GuildMember,
Partials.User,
],
});
const testMode = false;

client.on("error", (error) => {
console.error("An error occurred:", error);
});

client.on("ready", async () => {
console.log(`Logged in as as ${client.user.tag}!`);
console.log(`Bot is in ${client.guilds.cache.size} servers`);
});
client.on("debug", (debug) => {
console.log(
`${new Date().getUTCHours()}:${new Date().getUTCMinutes()}:${new Date().getUTCSeconds()} || ${debug}`
);
});

client.on("messageCreate", async (msg) => {
console.log(msg.author.id);
});

client.login(testMode ? process.env.TEST_TOKEN : process.env.BOT_TOKEN);

const { Client, GatewayIntentBits, Partials } = require("discord.js");
require("dotenv").config();
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
],
partials: [
Partials.Message,
Partials.Channel,
Partials.Reaction,
Partials.GuildMember,
Partials.User,
],
});
const testMode = false;

client.on("error", (error) => {
console.error("An error occurred:", error);
});

client.on("ready", async () => {
console.log(`Logged in as as ${client.user.tag}!`);
console.log(`Bot is in ${client.guilds.cache.size} servers`);
});
client.on("debug", (debug) => {
console.log(
`${new Date().getUTCHours()}:${new Date().getUTCMinutes()}:${new Date().getUTCSeconds()} || ${debug}`
);
});

client.on("messageCreate", async (msg) => {
console.log(msg.author.id);
});

client.login(testMode ? process.env.TEST_TOKEN : process.env.BOT_TOKEN);

it seems to be working so the issue is connection or the intents? hmm
const thingsToDefaultCache = [
"GuildChannelManager",
"PermissionOverwriteManager",
"RoleManager",
"GuildManager",
"ChannelManager",
];
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMembers,
],
partials: [
Partials.Message,
Partials.Channel,
Partials.Reaction,
Partials.GuildMember,
Partials.User,
],
makeCache: (manager) => {
if (thingsToDefaultCache.includes(manager.name)) {
return new Collection();
}
return new LimitedCollection({
maxSize: 0,
});
},
});
const thingsToDefaultCache = [
"GuildChannelManager",
"PermissionOverwriteManager",
"RoleManager",
"GuildManager",
"ChannelManager",
];
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMembers,
],
partials: [
Partials.Message,
Partials.Channel,
Partials.Reaction,
Partials.GuildMember,
Partials.User,
],
makeCache: (manager) => {
if (thingsToDefaultCache.includes(manager.name)) {
return new Collection();
}
return new LimitedCollection({
maxSize: 0,
});
},
});
so here I probably need presences and members tho mhh Shows different embes embeds to mobile and desktop users for members I am fetching users to give roles etc its working tho pepehm me send you the thing we have adjustcoin multiple to add coins to roles
const role = interaction.options.getRole("role");
let users = await client.guilds.cache
.get(interaction.guild.id)
.members.fetch();

users = users.filter((x) => x.roles.cache.has(role.id));
const role = interaction.options.getRole("role");
let users = await client.guilds.cache
.get(interaction.guild.id)
.members.fetch();

users = users.filter((x) => x.roles.cache.has(role.id));
does this code need that members.fetch part bot was taking 1.5gb mem when I was using it without customized caching so here if I remove the last 2, should it work presence and member was using render but it started crashing so switched to heroku I think thats the main difference from many bots right didnt see anyone using presence intent with huge bots oh yeah my vps stopped working so thats why I changed the render at first it all depends on connection right, for me? presence most likely taking too much time and connection cant keep up okay I think you are right removed presence only from this code and its working on my local
! Seferog
! Seferog7mo ago
No description
! Seferog
! Seferog7mo ago
6sec good? what would be optimal I guess this kek
! Seferog
! Seferog7mo ago
No description
! Seferog
! Seferog7mo ago
on my test bot with 2 servers Thank you so much I will update you here if it works flawless
! Seferog
! Seferog7mo ago
No description
! Seferog
! Seferog7mo ago
@Qjuh it was indeed presences thank you for support