-
Notifications
You must be signed in to change notification settings - Fork 1
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(sitelaunch): do not throw for no dig results #1355
fix(sitelaunch): do not throw for no dig results #1355
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @kishore03109 and the rest of your teammates on Graphite |
@@ -315,6 +316,12 @@ export class FormsgSiteLaunchRouter { | |||
logger.info( | |||
`Domain ${launchResult.primaryDomainSource} does not have any CAA records.` | |||
) | |||
|
|||
// if no CAA records, no need to add Amazon CAA and letsencrypt.org CAA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without this return, this ended up throwing an error instead
@@ -252,6 +252,7 @@ export class FormsgSiteLaunchRouter { | |||
logger.info( | |||
`Domain ${launchResult.primaryDomainSource} does not have any AAAA records.` | |||
) | |||
return [] // no AAAA records found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without this return, this ended up throwing an error instead
logger.error( | ||
`Error when trying to get AAAA records for domain ${launchResult.primaryDomainSource}: ${e}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/nit since you're editing this file, you could take the opportunity to clean up the neighbouring log statements. The existing statements does not print the error (since errors are not serializable).
logger.error( | |
`Error when trying to get AAAA records for domain ${launchResult.primaryDomainSource}: ${e}` | |
logger.error({ | |
message: 'Error when trying to get AAAA records for domain', | |
error: e, | |
meta: { | |
domain: launchResult.primaryDomainSource | |
} | |
}) |
Same can be done for the other error() and info() logs seen as context code in the PR.
But yeah, so main message with enahnced logging:
- report errors as-is, let the logger figure out how to export it
- log parameters as fields rather than interpolated content in the message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since merged will create a separate pr #1358 ya
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes Sir 👍 . Thank you 🙏 .
Problem
When there was no records that were found, dns:node throws an error. While we did handle it, there should have been an additional return statement to exit early rather than propagating into an error state.
Solution
If the error is of type
ENODATA
, return early with some default values instead.Breaking Changes
Tests
Locally enter these values into
support/routes/v2/formsg/index.ts
assert that the console log outputs
Deploy Notes
This fix is meant to go into prod line asap