Webhook not creating/sending

So I have a daily message system that creates a webhook if there is none or sends a embed message if the webhook exists. This all works fine in my best bot but when I try to move it to production it wont send/create the webhooks on most server. Around 200 servers use that system but the bot only made 20webhooks so far. It also cant be a permissions issue as I gave the bot admin on my dev server and it still didn't send/create anything. There is also no error logged which is weird. This whole error is really annoying as I'm not sure how to fix it so I'm looking for help here: Code for the daily message system: https://gist.github.com/mezotv/ccd892a7500334f54c68df31929c2e8e Code for our webhook handler: https://gist.github.com/mezotv/2635d066c28c246020fe2890128708d3 Full code (if needed): https://github.com/Would-You-Bot/Would-You/tree/debugCommandPlusTranslateFix
55 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dominik
DominikOP2y ago
We have our own caching system thats really strict so without fetching the channels it wouldnt work Will add that! Alright ive gone ahead and added that! Will see if that runs. Also do you think it would be smart to remove all the ?. and Cant really tell you that as I wasnt the one who worked on that @seandev might know more
sean
sean2y ago
everything expect user and guild member and othet djs requited things We dont overwrite djs cache system our “own” is just the db cacher and webhook cacher
Dominik
DominikOP2y ago
Yea thats what I meant
sean
sean2y ago
100%? I mean at the end there is no issue by using fetch bcs it checks the cache first or not 🤔 yeah but i would go crazy if that would be the issue
Dominik
DominikOP2y ago
I wish that was the error bc then we finally found it
sean
sean2y ago
I wanted to go sleep now Cry mean when client.user.id is not set its valid to get sweept bcs the client user is broken then lol or not? ig when client user id is not set then we have a way other problems bcs this should never happen @dominikdev the daily msg should send about ~200 msg right?
Dominik
DominikOP2y ago
around 200 if the bot got perms to do so but without perms it should also send a error message
sean
sean2y ago
could u try to add a number upcounter like at the start of the cronjob u add something like test = 0; and at every webhookManager.sendWrbhook() above of this function u do test++; and then on the end of the cronjob u do a console.log(test) do u get what i mean?
Dominik
DominikOP2y ago
Yea sure
Dominik
DominikOP2y ago
Alright looks something like this now above every sent
sean
sean2y ago
yes
Dominik
DominikOP2y ago
Shall I push that test to production?
sean
sean2y ago
production i mean at the end it wont log anything near to 200 bcs of the timezones
Dominik
DominikOP2y ago
alright sure Alr bot is started now It logged 0 now which makes sense since nobody uses that timezone. It should log way more tomorrow at 12pm America/Chicago time Hey so @qjuh @seandev The bot logged 0 now and an error
DiscordAPIError[50035]: Invalid Form Body
channel_id[NUMBER_TYPE_COERCE]: Value "null" is not snowflake.
at SequentialHandler.runRequest (/home/wouldyounew/node_modules/@discordjs/rest/dist/index.js:667:15)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (/home/wouldyounew/node_modules/@discordjs/rest/dist/index.js:464:14)
at async REST.request (/home/wouldyounew/node_modules/@discordjs/rest/dist/index.js:910:22)
at async ChannelManager.fetch (/home/wouldyounew/node_modules/discord.js/src/managers/ChannelManager.js:123:18)
at async Timeout._onTimeout (/home/wouldyounew/src/util/dailyMessage.js:42:37) {
requestBody: { files: undefined, json: undefined },
rawError: {
code: 50035,
errors: { channel_id: [Object] },
message: 'Invalid Form Body'
},
code: 50035,
status: 400,
method: 'GET',
url: 'https://discord.com/api/v10/channels/null'
}
DiscordAPIError[50035]: Invalid Form Body
channel_id[NUMBER_TYPE_COERCE]: Value "null" is not snowflake.
at SequentialHandler.runRequest (/home/wouldyounew/node_modules/@discordjs/rest/dist/index.js:667:15)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (/home/wouldyounew/node_modules/@discordjs/rest/dist/index.js:464:14)
at async REST.request (/home/wouldyounew/node_modules/@discordjs/rest/dist/index.js:910:22)
at async ChannelManager.fetch (/home/wouldyounew/node_modules/discord.js/src/managers/ChannelManager.js:123:18)
at async Timeout._onTimeout (/home/wouldyounew/src/util/dailyMessage.js:42:37) {
requestBody: { files: undefined, json: undefined },
rawError: {
code: 50035,
errors: { channel_id: [Object] },
message: 'Invalid Form Body'
},
code: 50035,
status: 400,
method: 'GET',
url: 'https://discord.com/api/v10/channels/null'
}
Thats def something we can work with right Will look at that in a sec
sean
sean2y ago
yeah it is
Dominik
DominikOP2y ago
so thats probably why it isnt working right
sean
sean2y ago
true xD
Dominik
DominikOP2y ago
Im sorry just though you would like an update
sean
sean2y ago
It should not be the issue bcs we catch unhandledRejection so the code wont stop and do the for loop
Dominik
DominikOP2y ago
Well yea but that error gets logged in a catch Still maybe because some value is null it wont send any webhooks etc hard to explain rn Ill tell you what I meant later
sean
sean2y ago
yeah obv thats why the catch is there xD and to notice that we have the channel?.id to make sure its set even if a error happen
Dominik
DominikOP2y ago
atleast we got somet sort of an error message now and can debug further
sean
sean2y ago
yeah add a
if(!db?.dailyChannel) return;
if(!db?.dailyChannel) return;
Dominik
DominikOP2y ago
why debugchannel tho
sean
sean2y ago
sorry
Dominik
DominikOP2y ago
ahh sure
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dominik
DominikOP2y ago
let me test sth Currently there are 27 documents so my guess would be that it adds 1 every run
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dominik
DominikOP2y ago
1 webhook
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dominik
DominikOP2y ago
Okay 37 out of 201 dailyChannels are null
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dominik
DominikOP2y ago
that command is messed up
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dominik
DominikOP2y ago
I think there is a boolean value that we store as a string
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dominik
DominikOP2y ago
idk if that was dailymsg tho In general we need a setup command with buttons that gives you an overview on what settings you set That could be something we work on sky and add to the todo
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dominik
DominikOP2y ago
when the user sets dailymsg to true does he check if there is a channel set if not we can add that
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dominik
DominikOP2y ago
then how do some servers not have one set
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dominik
DominikOP2y ago
hmm We should still make the whole command easier to use
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dominik
DominikOP2y ago
Like this yk
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dominik
DominikOP2y ago
and to wy
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dominik
DominikOP2y ago
welcome putting all of these into 1 /settings command sounds the smartest to me /settings welcome/dailymsg
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dominik
DominikOP2y ago
lets add to todo before we forget
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dominik
DominikOP2y ago
I asked meister (the dev behind bump reminder) for help and he said he will in march I hope we wont need his help tho because till then its a long time
Want results from more Discord servers?
Add your server