Ban reasons are no longer showing up in audit logs

I’m using djs v14. Previously, ban reasons would show up in the server’s audit logs as expected. However, this functionality seems to have stopped working out of nowhere. At the time it stopped working, no code changes were made nor has my bot restarted. Has anyone else been experiencing similar issues? (It isn’t just bans, it is anything that supports an audit log reason)
24 Replies
d.js toolkit
d.js toolkit14mo 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!
nick.
nick.OP14mo ago
they are not appearing in the client, nor are other bots able to see them. they are also no longer appearing in the bans tab
await guild.members.ban(id, {
reason: `Ban command used by ${user.username}#${user.discriminator}. Reason: ${truncateReason(
reason,
400
)}`,
deleteMessageDays: days,
});
await guild.members.ban(id, {
reason: `Ban command used by ${user.username}#${user.discriminator}. Reason: ${truncateReason(
reason,
400
)}`,
deleteMessageDays: days,
});
the ban gets created as expected, just the reason doesn't work anymore* very weird. i can try to create a minimal reproduction and work from there i suppose i noticed that, just haven't gotten around to changing it yet. i can't see why that would cause this issue but i will test for it anyway it isn't just bans, the same happens with timeouts etc I am not, they are also truncated (if the user inputs a long value of course)
nick.
nick.OP14mo ago
No description
nick.
nick.OP14mo ago
No description
nick.
nick.OP14mo ago
No description
nick.
nick.OP14mo ago
No description
nick.
nick.OP14mo ago
??? i'm so confused wtf worked fine in the attempt at reproducing the issue not the actual instance of my bot same test server, same test bot, just the code is different indeed ok it still didn't work but there's something else I want to test now I'm running an instance of @discordjs/proxy for my actual bot and I have a sneaking suspicion that it may be stripping the header or something I'm going to try changing my minimal repro to use a proxy IT IS wtf this is my code using /proxy, it is very much based off of proxy-container, I just wanted a bit more control over the node version etc, and the ability to run it on an arm64 host:
import { proxyRequests } from "@discordjs/proxy";
import { REST } from "@discordjs/rest";
import { createServer } from "node:http";
import process from "node:process";

const globalRequestsPerSecond = parseInt(
process.env.GLOBAL_REQUESTS_PER_SECOND ?? "50",
10
);

const api = new REST({
globalRequestsPerSecond,
rejectOnRateLimit: () => true,
retries: 0,
});

const server = createServer(proxyRequests(api));

const port = parseInt(process.env.PORT ?? "8080", 10);

server.listen(port, () =>
console.log(
`Listening on port ${port}. Global requests per second limited to ${globalRequestsPerSecond}.`
)
);
import { proxyRequests } from "@discordjs/proxy";
import { REST } from "@discordjs/rest";
import { createServer } from "node:http";
import process from "node:process";

const globalRequestsPerSecond = parseInt(
process.env.GLOBAL_REQUESTS_PER_SECOND ?? "50",
10
);

const api = new REST({
globalRequestsPerSecond,
rejectOnRateLimit: () => true,
retries: 0,
});

const server = createServer(proxyRequests(api));

const port = parseInt(process.env.PORT ?? "8080", 10);

server.listen(port, () =>
console.log(
`Listening on port ${port}. Global requests per second limited to ${globalRequestsPerSecond}.`
)
);
only other change needed to this was the option to use the proxy:
rest: { api: `http://localhost:8080/api` },
rest: { api: `http://localhost:8080/api` },
looks like it's /proxy unless I've screwed something up here
nick.
nick.OP14mo ago
No description
nick.
nick.OP14mo ago
I think this is a bug in @discordjs/proxy yeah it looks like it's ignoring the X-Audit-Log-Reason header
nick.
nick.OP14mo ago
yep
No description
nick.
nick.OP14mo ago
that was the issue
nick.
nick.OP14mo ago
adding these lines to proxyRequests fixed it
No description
nick.
nick.OP14mo ago
I'll make a PR created the PR https://github.com/discordjs/discord.js/pull/9889 so just adding an as string?
nick.
nick.OP14mo ago
seems to have suppressed the error
No description
No description
nick.
nick.OP14mo ago
ffs
No description
nick.
nick.OP14mo ago
No description
nick.
nick.OP14mo ago
No description
nick.
nick.OP14mo ago
can I just remove this lmfao probably because i just npm install'd and ran with it i didn't have pnpm yeah no i didn't have pnpm installed before i did yeah kinda wishing i did that npm install took forever finally fixed it and force pushed
nick.
nick.OP14mo ago
yippee
No description
DD
DD14mo ago
yeah proxy container gets a new latest every 12h so should be fixed soon
nick.
nick.OP14mo ago
and proxy itself? is this going to be a standalone release or released with new features (noticed it was assigned the 2.1.0 milestone instead of a 2.0.2)
DD
DD14mo ago
idk @jiralite manages milestones usually we make minors by default anyway and adjust before release i think
nick.
nick.OP14mo ago
alright how often do new releases for proxy come out? undecided if I should just use patch-package in the meantime
DD
DD14mo ago
12h like all packages
Want results from more Discord servers?
Add your server