Error: Expected token to be set for this request, but none was present

I'm not sure why this is happening
20 Replies
d.js toolkit
d.js toolkit8mo 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 OP
시유
시유OP8mo ago
Please help me With this error, it is shown offline on certain shards
Error: Expected token to be set for this request, but none was present
at _REST.resolveRequest (/opu/node_modules/@discordjs/rest/dist/index.js:1340:15)
at _REST.queueRequest (/opu/node_modules/@discordjs/rest/dist/index.js:1300:46)
at _REST.request (/opu/node_modules/@discordjs/rest/dist/index.js:1266:33)
at _REST.post (/opu/node_modules/@discordjs/rest/dist/index.js:1240:17)
at TextChannel.send (/opu/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:155:38)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async module.exports (/opu/src/events/Lavalink/trackStart.js:54:26

Error: Expected token to be set for this request, but none was present
at _REST.resolveRequest (/opu/node_modules/@discordjs/rest/dist/index.js:1340:15)
at _REST.queueRequest (/opu/node_modules/@discordjs/rest/dist/index.js:1300:46)
at _REST.request (/opu/node_modules/@discordjs/rest/dist/index.js:1266:33)
at _REST.patch (/opu/node_modules/@discordjs/rest/dist/index.js:1258:17)
at GuildMessageManager.edit (/opu/node_modules/discord.js/src/managers/MessageManager.js:187:38)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async TrackStart (/opu/src/utils/functions.js:221:16
Error: Expected token to be set for this request, but none was present
at _REST.resolveRequest (/opu/node_modules/@discordjs/rest/dist/index.js:1340:15)
at _REST.queueRequest (/opu/node_modules/@discordjs/rest/dist/index.js:1300:46)
at _REST.request (/opu/node_modules/@discordjs/rest/dist/index.js:1266:33)
at _REST.post (/opu/node_modules/@discordjs/rest/dist/index.js:1240:17)
at TextChannel.send (/opu/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:155:38)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async module.exports (/opu/src/events/Lavalink/trackStart.js:54:26

Error: Expected token to be set for this request, but none was present
at _REST.resolveRequest (/opu/node_modules/@discordjs/rest/dist/index.js:1340:15)
at _REST.queueRequest (/opu/node_modules/@discordjs/rest/dist/index.js:1300:46)
at _REST.request (/opu/node_modules/@discordjs/rest/dist/index.js:1266:33)
at _REST.patch (/opu/node_modules/@discordjs/rest/dist/index.js:1258:17)
at GuildMessageManager.edit (/opu/node_modules/discord.js/src/managers/MessageManager.js:187:38)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async TrackStart (/opu/src/utils/functions.js:221:16
시유
시유OP8mo ago
No description
시유
시유OP8mo ago
Bots and shards turn on normally After about two hours, the shard dies and the error occurs Use the latest version of djs Shard disconnected
[Warning] 샤드 #59와의 연결이 끊어졌어요. {
code: 1000,
reason: 'the reason property is deprecated, use the code property to determine the reason',
wasClean: true
}
[Warning] 샤드 #58와의 연결이 끊어졌어요. {
code: 1000,
reason: 'the reason property is deprecated, use the code property to determine the reason',
wasClean: true
}
[Warning] 샤드 #59와의 연결이 끊어졌어요. {
code: 1000,
reason: 'the reason property is deprecated, use the code property to determine the reason',
wasClean: true
}
[Warning] 샤드 #58와의 연결이 끊어졌어요. {
code: 1000,
reason: 'the reason property is deprecated, use the code property to determine the reason',
wasClean: true
}
module.exports = {
name: "shardDisconnect",
run: async (client, event, id) => {
console.log(`[Warning] 샤드 #${id}와의 연결이 끊어졌어요.`, event);
}
};
module.exports = {
name: "shardDisconnect",
run: async (client, event, id) => {
console.log(`[Warning] 샤드 #${id}와의 연결이 끊어졌어요.`, event);
}
};
May I know why this error occurs? The problem is this error occurs every four hours The shard doesn't even turn back on normally yes 94 shards I changed the hosting and tried it, but it was the same If I change to djs ShardingManager, can I change the structure to multiple servers?
space
space8mo ago
Yes, checkout the shardList and shardCount options of the sharding manager.
시유
시유OP8mo ago
Server specifications are too broad, so what do you deal with discord bots with? cpu? network?
시유
시유OP8mo ago
No description
시유
시유OP8mo ago
It's not a single server problem
const { ShardingManager } = require("discord.js");
const config = require("./src/config.js");
const { RecommededShards, GetShardIds } = require("./src/utils/shards.js");

async function shards_start() {
let totalShards = 0;
try {
totalShards = await RecommededShards(config.token, config.sharding.guildsPerShard);
} catch (error) {
return console.log(error);
}

let Shards = GetShardIds(totalShards, config.sharding.totalMachines, config.sharding.machineId);

let manager = new ShardingManager("./src/index.js", { token: config.token, totalShards: totalShards, shardList: Shards, respawn: true });

manager.on("shardCreate", (shard) => console.log(`Launched shard ${shard.id}`));

manager.spawn();
}

shards_start();

process.on("unhandledRejection", (error) => {
console.error("Unhandled promise rejection:", error);
});
const { ShardingManager } = require("discord.js");
const config = require("./src/config.js");
const { RecommededShards, GetShardIds } = require("./src/utils/shards.js");

async function shards_start() {
let totalShards = 0;
try {
totalShards = await RecommededShards(config.token, config.sharding.guildsPerShard);
} catch (error) {
return console.log(error);
}

let Shards = GetShardIds(totalShards, config.sharding.totalMachines, config.sharding.machineId);

let manager = new ShardingManager("./src/index.js", { token: config.token, totalShards: totalShards, shardList: Shards, respawn: true });

manager.on("shardCreate", (shard) => console.log(`Launched shard ${shard.id}`));

manager.spawn();
}

shards_start();

process.on("unhandledRejection", (error) => {
console.error("Unhandled promise rejection:", error);
});
The clustering worked fine, but the error was not resolved
시유
시유OP8mo ago
No description
시유
시유OP8mo ago
Shard #31 isn't the only time you die
시유
시유OP8mo ago
No description
No description
시유
시유OP8mo ago
index.js
const Poppy = require("./structures/PoppyClient");
const client = new Poppy();

client.connect()

module.exports = client;
const Poppy = require("./structures/PoppyClient");
const client = new Poppy();

client.connect()

module.exports = client;
If it's a debug event, do you mean the API log?
d.js docs
d.js docs8mo ago
:event: (event) Client#debug Emitted for general debugging information. Please add the following code to your code base outside of any other event listeners and provide the full log output relevant to your issue.
client
.on("debug", console.log)
.on("warn", console.log)
client
.on("debug", console.log)
.on("warn", console.log)
- Note: if you initialize your Client as bot or other identifiers you need to use these instead of client - If the output is too long to post consider using a bin instead: gist | paste.gg | sourceb.in | hastebin
시유
시유OP8mo ago
I'll give it a try.
시유
시유OP8mo ago
No description
시유
시유OP8mo ago
I'm attaching a debug log because a problem occurred
시유
시유OP8mo ago
No description
d.js docs
d.js docs8mo ago
To share long code snippets, use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks or files.
시유
시유OP8mo ago
I'll collect the log again and send it to you https://sourceb.in/hObR3xz7Rg https://sourceb.in/B7m1sklQ2n trackStuck.js
module.exports = async (player, track, payload) => {
return player.destroy();
};
module.exports = async (player, track, payload) => {
return player.destroy();
};
Looks like a Lavalink module error. Thank you so much for helping me fix the problem oh My mistake
Want results from more Discord servers?
Add your server