Not sending Discord notifications (Test works)


Go to solution Solved by ljm42,

Recommended Posts

I'm setting up a discord server for my homelab and with unraid, I'm having some issues.

 

image.thumb.png.9e73211fabe975c12ac51c4fda49b5bf.png

 

And here's how I've set the Discord agent:

 

322452121_ScreenShot2022-08-22at6_58_04AM.thumb.png.f3eac3f63ca506bcc36585cf57e815de.png

 

Now, I can receive the test notifications just fine:

 

image.png.d8348ae2c2fef97d0298d17e2bada89b.png

 

But I'm not receiving any other notifications. I only see notifications in the unraid web ui. Even adding my tag id (the numbers) doesn't work. All I see in syslog is

 

Aug 22 06:52:01 Tower Discord.sh: Failed sending notification

 

Is there any way to turn up verbosity of Discord.sh or see why it failed?

Edited by Howboys
Link to comment

If `/var/log/notify_Discord`, I see failed attempts to send notification but not actual errors or reasons why. Snippet:

 

Mon Aug 22 06:52:01 PDT 2022
attempt 1 of 4 failed
{"embeds": ["0"]}

 

I also don't see further attempts in logs - just 1 of 4 as above for different notifications.

 

I can do a quick test just fine:

 

bash /boot/config/plugins/dynamix/notifications/agents/Discord.sh

 

And I see the notification in Discord.

 

But when I do a full test:

 

/usr/local/emhttp/webGui/scripts/notify -e "My Event" -s "My Subject" -d "My Description"  -m "My Message" -i "alert" -l "/Dashboard"

 

I only see the notification in the UI and NOT in Discord. Here's the log for that:

 

Mon Aug 22 07:18:13 PDT 2022
attempt 1 of 4 failed
{"embeds": ["0"]}
{
"content": "<@1234>",
"embeds": [
{
"title": "My Event",
"description": "My Subject",
"url": "http://Tower/Dashboard",
"timestamp": "2022-08-22T14:18:12.000Z",
"color": "14821416",
"author": {
"icon_url": "https://craftassets.unraid.net/uploads/logos/[email protected]",
"name": "Tower"
},
"thumbnail": {
"url": "https://craftassets.unraid.net/uploads/discord/notify-alert.png"
},
"fields": [
{
"name": "Description",
"value": "My Description\n\nMy Message"
},
{
"name": "Priority",
"value": "alert",
"inline": true
}
]
}
]
}

 

Link to comment

Since it's all bash, I'd increase syslog's logging level to debug and re-test, then evaluate based on what you see there.

 

If you haven't attempted rebooting the host yet, that's worth a shot prior to investing the effort into debug - there are times where something in memory isnt updated to reflect config changes, which a reboot would then fix. Not common, but worth a shot.

 

If both of those come up empty (e.g. you find its something network related), you're next bet is unfortunately likely a packet trace (ugh).

 

 

22 minutes ago, Howboys said:

Any help?

 

It's only been about 24 hours, and we're mostly volunteer here - we do what we can, but sometimes it takes us a bit. Little patience goes a long way ❤️

Link to comment
  • Solution

Interesting. So this is another problem related to having a blank "Local TLD". Discord won't accept the submission with this bare url:

"url": "http://Tower/Dashboard",

 

I strongly recommend that you go to Settings -> Management Access and change "Local TLD" from blank to "local" (without the quotes). This will solve this problem with Discord by changing the url to:

http://Tower.local/Dashboard

 

I'd also recommend installing the Fix Common Problems plugin as it would have alerted you to other potential issues related to a blank Local TLD, more info here:
  https://forums.unraid.net/topic/120220-fix-common-problems-more-information/?tab=comments#comment-1099981 

 

Link to comment

@ljm42Sorry to bug ya with a seemingly unnecessary follow up, but wanted to ask - do you know, or happen to recall, how this was initially sorted out? Debug's annoying, and pktt felt like crazy overkill, but I honestly couldnt think of any other way around it, and am wondering if theres some other simpler method that would've pointed to the answer (initially I mean, prior to it being added to tips and tweaks).

 

Thanks for your time!

Link to comment
3 hours ago, Howboys said:

Ah that fixed it! 

 

Glad to hear it!

 

3 hours ago, BVD said:

Sorry to bug ya with a seemingly unnecessary follow up, but wanted to ask - do you know, or happen to recall, how this was initially sorted out? 

 

Howboys provided the details of their test submission. I submitted that to my Discord server and it failed, so that meant there was a problem with the data. Discord does not give good failure messages so I compared it to a working submission from one of my Unraid servers and narrowed the difference down to the url. Did a few more tests to confirm.

 

BTW, I also submitted a patch for the webgui, hopefully will make it into 6.11:

  https://github.com/limetech/webgui/pull/1153

Basically, if the url does not include a Local TLD, the URL will be removed from the submission to Discord. This will allow notifications to be sent to Discord even if the Local TLD is not defined, but I would still recommend that everyone define a Local TLD on their servers.

  • Thanks 2
Link to comment
  • 11 months later...
On 8/24/2022 at 2:43 AM, ljm42 said:

 

Glad to hear it!

 

 

Howboys provided the details of their test submission. I submitted that to my Discord server and it failed, so that meant there was a problem with the data. Discord does not give good failure messages so I compared it to a working submission from one of my Unraid servers and narrowed the difference down to the url. Did a few more tests to confirm.

 

BTW, I also submitted a patch for the webgui, hopefully will make it into 6.11:

  https://github.com/limetech/webgui/pull/1153

Basically, if the url does not include a Local TLD, the URL will be removed from the submission to Discord. This will allow notifications to be sent to Discord even if the Local TLD is not defined, but I would still recommend that everyone define a Local TLD on their servers.

Have there been any other reports of discord notifications failing?  I'm able to send test notifications just fine, but other notifications aren't working.  The Local TLD was set before I enabled the discord agent.

Link to comment
On 7/29/2023 at 5:50 AM, thewave said:

Have there been any other reports of discord notifications failing?  I'm able to send test notifications just fine, but other notifications aren't working.  The Local TLD was set before I enabled the discord agent.

 

If there are errors, they will be logged in /var/log/notify_Discord . You can view the log with:

cat /var/log/notify_Discord


If you post the info here I may be able to help parse it.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.