-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webhook#send throws DiscordAPIError: 405: Method Not Allowed #5731
Comments
I'm having similar issues. Any hacky workarounds I could implement in the meantime? |
@UltimateBrent for my application, I directly edited fetchWebhook(id, token) {
return this.api
.webhooks(id, token)
.get()
.then(data => new Webhook(this, {...data, token})); // <-- the second param here
} This re-attaches the token to the webhook payload as it should be based on the api docs, and then everything else works as expected. Obviously, editing the compiled code directly in node_modules isn't a scalable solution, but for me it'll work until an actual fix can be implemented. |
To quote an answer from a discord dev posted in the server a few minutes ago So this does not sound like something that djs should be trying to fix. |
@Darqam awesome, that's totally acceptable to me. I figure those working on this library have more "insider knowledge" in terms of bugs with the Discord API than I would. In that case, at least the hacky workaround above will hold me over until Discord is able to address the issue at hand. |
In the last 2 days or so, I've started seeing errors pop up in my deployed bot instance when attempting to send messages via a fetched webhook. This code has been deployed for over a month plus, so my assumption is that perhaps something may have changed with the Discord API itself (at the time of writing, no reports on their status page). I've spent some time digging into this, and it looks like the request message that is being sent to the api is in the format
POST api/webhooks/webhookId
, when based on the documentation, it should bePOST api/webhooks/webhookId/webhookToken
. When adding the token to the request url that is failing, it does function as expected.Continuing to dive further, I was able to determine in my test application that
this.token
in theWebhook.js
code was never being set. Tracking back up the tree, I foundClient#fetchWebhook
, which is what is being used to look up the webhook information. Looking at the data response here, it looks as though Discord is not returning the token associated with the webhook in the data payload, resulting in the further failures. Checking this, even though thetoken
is supposed to be returned for the Incoming Webhook data type, for some reason that is no longer the case.The easiest resolution in this case is to patch the data object returned from the API to include to the token which is already accessible to the
fetchWebhook
method, though that may very well not be the best solution.Reproduction
https://github.com/dallastjames/discordjs-webhook-send-error
Further details:
Relevant client options:
The text was updated successfully, but these errors were encountered: