@discordjs/rest requests behave differently when deployed to a serverless node environment vs. local

Using @discordjs/rest to create a standalone node project in an express-like API, await api.interactions.defer() hangs and never completes when running in an edge environment. is there a way to disable queued requests and always make the REST client that I create make requests sequentially? I can't even see the errors being thrown or if the request is being cancelled.
2 Replies
d.js toolkit
d.js toolkit11mo 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!
̶v̶o̶i̶d̶
̶v̶o̶i̶d̶11mo ago
await api.interactions.defer(message.id, message.token, {
flags: 64,
});
const result = await command.run(message.id);
await api.interactions.editReply(
process.env.DISCORD_APP_ID!,
message.token,
{
content: result,
flags: 64,
},
);
await api.interactions.defer(message.id, message.token, {
flags: 64,
});
const result = await command.run(message.id);
await api.interactions.editReply(
process.env.DISCORD_APP_ID!,
message.token,
{
content: result,
flags: 64,
},
);
running @discordjs/core@1.0.0 and @discordjs/rest@2.0.0 creating my api client:
const rest = new REST({ version: "10" }).setToken(
process.env.DISCORD_BOT_TOKEN!,
);
const api = new API(rest);
const rest = new REST({ version: "10" }).setToken(
process.env.DISCORD_BOT_TOKEN!,
);
const api = new API(rest);
cool thanks for the tips! hmm nothing is throwing 👀 if i don't await the first request to defer my interaction reply, the editReply and everything run and things appear fine but obviously i think i should be able to await that first request