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

feat: add logging to capture DNS resolution error #6631

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

wanlingt
Copy link
Contributor

@wanlingt wanlingt commented Aug 16, 2023

Problem

We need to capture the error message that's thrown by dns.resolve in validateWebhookUrl

Solution

Add logging

Breaking Changes

  • No - this PR is backwards compatible

Tests

  • Update a storage mode form with a webhook url that will fail DNS resolution
  • Submit a form
  • Check that error records appear in CloudWatch for the following query:
    fields @timestamp, @message, @logStream, @log
    | filter message like 'Webhook URL failed validation' and meta.action like 'validateWebhookUrl'

@wanlingt wanlingt marked this pull request as ready for review August 16, 2023 09:23
Copy link
Contributor

@tshuli tshuli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@wanlingt wanlingt merged commit 9f8fa1b into develop Aug 16, 2023
32 checks passed
@wanlingt wanlingt deleted the fix/webhook-url-error branch August 16, 2023 10:05
Copy link
Contributor

@LinHuiqing LinHuiqing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we pass in an error code or something into the WebhookValidationError error message so that the admins know what went wrong? So they won't have to contact us to debug.

@wanlingt
Copy link
Contributor Author

wanlingt commented Aug 16, 2023

Could we pass in an error code or something into the WebhookValidationError error message so that the admins know what went wrong? So they won't have to contact us to debug.

Actually we already validate the webhook URL in the Settings page when the form settings are updated so admins should be aware - I'm not sure how this admin was able to update their webhook to an invalid one

e.g.
image

@LinHuiqing
Copy link
Contributor

Actually we already validate the webhook URL in the Settings page when the form settings are updated so admins should already be aware - I'm not sure how this admin was able to update their webhook to an invalid one

Yea we do, but for this particular case, the webhook validation sometimes passes and sometimes fails. Like prior to their report, they have been sending to the same URL, and the webhook after the 1 problematic one eventually succeed as well. Okay but fair point in the case cos at the point when the webhook is attempted, the errors will only show up on our internal logs anyway and isn't shown to users). This should be sufficient then 👍 thanks @wanlingt!

@wanlingt wanlingt mentioned this pull request Aug 17, 2023
50 tasks
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.

3 participants