Skip to content
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

Fix(notification-aliyun-sms): throw error when sending SMS failed #3573

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

polunzh
Copy link
Contributor

@polunzh polunzh commented Aug 14, 2023

Tick the checkbox if you understand [x]:

  • I have read and understand the pull request rules.

Description

Throw error when sending Aliyun SMS failed, snapshot below.

Type of change

Please delete any options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • My code follows the style guidelines of this project
  • I ran ESLint and other linters for modified files
  • I have performed a self-review of my own code and tested it
  • I have commented my code, particularly in hard-to-understand areas
    (including JSDoc for methods)
  • My changes generate no new warnings
  • My code needed automated testing. I have added them (this is optional task)

Screenshots (if any)

image

Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically.

@CommanderStorm
Copy link
Collaborator

I don't quite know why you opened an empty PR (what would you like to discuss?)

Currently the alium-sms notification provider checks for success like this:

if (result.data.Message === "OK") {
return true;
}
return false;

@polunzh polunzh force-pushed the fix-notification-aliyun-sms branch from ff9acb1 to 2c84fc7 Compare August 14, 2023 11:11
@polunzh polunzh changed the title [empty commit] pull request for fix aliyun sms notification bug Fix(notification-aliyun-sms): throw error when sending SMS failed Aug 14, 2023
@polunzh
Copy link
Contributor Author

polunzh commented Aug 14, 2023

I don't quite know why you opened an empty PR (what would you like to discuss?)

Currently the alium-sms notification provider checks for success like this:

if (result.data.Message === "OK") {
return true;
}
return false;

Sorry, I updated the PR.

Original bugs:

  • The method this.sendSms() is an async function, so it must be called with await, or it will always be true:
    if (this.sendSms(notification, msgBody)) {
  • The method should throw error if response message is not OK instead of return false.

@CommanderStorm
Copy link
Collaborator

CommanderStorm commented Aug 14, 2023

The same problem (not awaiting the success-determiner) is also be present in these other poviders due to other devs copying code:

  • DingDing
  • FlashDuty
  • PagerDuty
  • PagerTree
  • Splunk

Could you attach a fix for these as well?

If you do, could you add Resolves #3458 to the description?

@louislam louislam added this to the 1.23.0 milestone Aug 14, 2023
@louislam
Copy link
Owner

The same problem (not awaiting the success-determiner) is also be present in these other poviders due to other devs copying code:

* `DingDing`

* `FlashDuty`

* `PagerDuty`

* `PagerTree`

* `Splunk`

Could you attach a fix for these as well?

If you do, could you add Resolves #3458 to the description?

Maybe do this in new pull request(s). Some of them are regional only notifications, I can't test the other normal cases. Since notification is an important feature in Uptime Kuma, it is required to find someone who actually can test it (up/down/test ok/test fail). Maybe we can reach back the og authors to test them.

@louislam louislam merged commit c0174dc into louislam:master Aug 14, 2023
14 checks passed
@CommanderStorm
Copy link
Collaborator

CommanderStorm commented Aug 14, 2023

While I don't agree that these changes require extra tests, let's ask the OG authors if they can duplicate+test these fixes across the other providers:

Currently these monitors don't report erros at all (they always succeed).
Could each of you please add:

  • an await statement to the function which your provider does not await
  • throwing errors instead of returning false to make them appear in the frontend

and document that these are fixed by attaching a screenshot as above of the monitor failing?

@AnnAngela
Copy link
Contributor

AnnAngela commented Aug 14, 2023

While I don't agree that these changes require extra tests, let's ask the OG authors if they can duplicate+test these fixes across the other providers:

Currently these monitors don't report erros at all (they always succeed).
Could each of you please add:

  • an await statement to the function which your provider does not await
  • throwing errors instead of returning false to make them appear in the frontend

and document that these are fixed by attaching a screenshot as above of the monitor failing?

I am not the author of Dingding provider (I only changed the timezone setting of output message), but if @dingdayu don't have time, I can take a look at thursday.

@polunzh polunzh deleted the fix-notification-aliyun-sms branch August 15, 2023 02:04
@polunzh
Copy link
Contributor Author

polunzh commented Aug 15, 2023

The same problem (not awaiting the success-determiner) is also be present in these other poviders due to other devs copying code:

  • DingDing
  • FlashDuty
  • PagerDuty
  • PagerTree
  • Splunk

Could you attach a fix for these as well?

If you do, could you add Resolves #3458 to the description?

Sorry, I can't promise to fix all of these notification issues, but I'll take a look over the weekend if it hasn't been fixed yet.

@guguji5
Copy link
Contributor

guguji5 commented Aug 18, 2023

@CommanderStorm Sorry to see this issue so late, is there any problem to fix the FlashDuty channel ? or fixed

@AnnAngela
Copy link
Contributor

AnnAngela commented Aug 18, 2023

@CommanderStorm @louislam I have made a pr #3598

louislam pushed a commit to AnnAngela/uptime-kuma that referenced this pull request Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants