louislam / uptime-kuma

A fancy self-hosted monitoring tool
https://uptime.kuma.pet
MIT License
60.74k stars 5.42k forks source link

Gotify throws out error when sending down notification #4568

Closed alexbcberio closed 8 months ago

alexbcberio commented 8 months ago

πŸ“‘ I have found these related issues/pull requests

πŸ›‘οΈ Security Policy

Description

Gotify notification provider does not send any "down" notification messages, "up" notification messages are sent correctly.

πŸ‘Ÿ Reproduction steps

Add Gotify provider and wait or force a "down" notification message

πŸ‘€ Expected behavior

The down notification message should be correctly processed by Gotify

πŸ˜“ Actual Behavior

Gotify server rejects the message

🐻 Uptime-Kuma Version

1.23.11

πŸ’» Operating System and Arch

Ubuntu 22.04

🌐 Browser

any

πŸ–₯️ Deployment Environment

πŸ“ Relevant log output

uptime-kuma  | Error: Error: AxiosError: Request failed with status code 500 {"error":"Internal Server Error","errorCode":500,"errorDescription":"Error 1366: Incorrect string value: '\\xF0\\x9F\\x94\\xB4 D...' for column `gotify`.`messages`.`message` at row 1"}
uptime-kuma  |     at Gotify.throwGeneralAxiosError (/app/server/notification-providers/notification-provider.js:38:15)
uptime-kuma  |     at Gotify.send (/app/server/notification-providers/gotify.js:23:18)
uptime-kuma  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
uptime-kuma  |     at async Monitor.sendNotification (/app/server/model/monitor.js:1421:21)
uptime-kuma  |     at async beat (/app/server/model/monitor.js:958:21)
uptime-kuma  |     at async Timeout.safeBeat [as _onTimeout] (/app/server/model/monitor.js:1026:17)
chakflying commented 8 months ago

I think this is still the same issue as #1148. What is the database configuration used for the Gotify server?

alexbcberio commented 8 months ago

Yes, as I already mentioned in the main message the issue is the same as on #1148.

The difference is on the used database provider. I'm using the embedded sqlite (I haven't found any docs regarding how to set it up to MariaDB) while this other issue is using MariaDB as the database provider.

Edit: the database provider for Gotify is MariaDB.

CommanderStorm commented 8 months ago

So the same issue, correct?

If that is the case, we should definitely adapt the helptext for said monitor. What do you think would be a good way to phrase this "oddity"

alexbcberio commented 8 months ago

OMG, I have been messing up between Gotify database and Uptime-Kuma database all this time.

You're completely right, its the same issue. I have updated Gotify settings and its working ok.

Hmm, as for the phrasing I would add a notice telling "Ensure Gotify database connection url encoding matches the database encoding (utf8, utf8mb4, etc)". It might also be a good idea, if it were possible, to customize the "Test" message adding some known characters that cause issues.

Thanks for the fast support and replying so fast!

CommanderStorm commented 8 months ago

It might also be a good idea, if it were possible, to customize the "Test" message adding some known characters that cause issues.

That sounds like something you would need to set up gotify for (taking time out of my/another maintainers "time-budget" which could be used for other purposes). Given that you already have this notification provider set up, would it be possible for you to contribute such a change and test that the character reproduces the case as intended? Our contribution guide (how to set up a dev-environment) can be found here and the two relevant lines are:

alexbcberio commented 8 months ago

I will consider contributing to add this feature.

Thanks for the details!