There was a bug in the implementation of #1355. This worked for sites that were already launched. Newer sites which do no resolve to any host name throws a ENOTFOUND, which should be an ok error.
Solution
To fix this issue, we explicitly check for this error code as well to ensure that this does not error out.
Breaking Changes
[ ] Yes - this PR contains breaking changes
Details ...
[X] No - this PR is backwards compatible with ALL of the following feature flags in this doc
Tests
tldr; below we are testing for
domains that have caa + aaaa record (google.com)
domains that dont resolve to a host name (dontexist.sg)
domains that do resolve to a host name but dont have an aaaa/caa record (isomer.gov.sg)
Locally enter these values into support/routes/v2/formsg/index.ts
formsgSiteLaunchRouter
.digAAAADomainRecords({
primaryDomainSource: "isomer.gov.sg",
} as SiteLaunchResult)
.then(console.log)
.catch(console.error)
formsgSiteLaunchRouter
.digCAADomainRecords({
primaryDomainSource: "isomer.gov.sg",
} as SiteLaunchResult)
.then(console.log)
.catch(console.error)
formsgSiteLaunchRouter
.digAAAADomainRecords({
primaryDomainSource: "dontexist.sg",
} as SiteLaunchResult)
.then(console.log)
.catch(console.error)
formsgSiteLaunchRouter
.digCAADomainRecords({
primaryDomainSource: "dontexist.sg",
} as SiteLaunchResult)
.then(console.log)
.catch(console.error)
formsgSiteLaunchRouter
.digAAAADomainRecords({
primaryDomainSource: "google.com",
} as SiteLaunchResult)
.then(console.log)
.catch(console.error)
formsgSiteLaunchRouter
.digCAADomainRecords({
primaryDomainSource: "google.com",
} as SiteLaunchResult)
.then(console.log)
.catch(console.error)
assert that the console log outputs
support-1 | [08:59:33.272] INFO (56): Domain does not have any AAAA records.
support-1 | module: "formsgSiteLaunch"
support-1 | meta: {
support-1 | "domain": "isomer.gov.sg"
support-1 | }
support-1 | { addAWSACMCertCAA: true, addLetsEncryptCAA: false }
support-1 | [
support-1 | {
support-1 | domain: 'google.com',
support-1 | type: 'AAAA',
support-1 | value: '2404:6800:4003:c11::64'
support-1 | },
support-1 | {
support-1 | domain: 'google.com',
support-1 | type: 'AAAA',
support-1 | value: '2404:6800:4003:c11::65'
support-1 | },
support-1 | {
support-1 | domain: 'google.com',
support-1 | type: 'AAAA',
support-1 | value: '2404:6800:4003:c11::71'
support-1 | },
support-1 | {
support-1 | domain: 'google.com',
support-1 | type: 'AAAA',
support-1 | value: '2404:6800:4003:c11::8b'
support-1 | }
support-1 | ]
support-1 | []
support-1 | { addAWSACMCertCAA: false, addLetsEncryptCAA: false }
support-1 | { addAWSACMCertCAA: false, addLetsEncryptCAA: false }
support-1 | []
support-1 | [08:59:33.272] INFO (56): Domain does not have any CAA records.
support-1 | module: "formsgSiteLaunch"
support-1 | meta: {
support-1 | "domain": "isomer.gov.sg"
support-1 | }
support-1 | [08:59:33.272] INFO (56): Domain does not have any CAA records.
support-1 | module: "formsgSiteLaunch"
support-1 | meta: {
support-1 | "domain": "dontexist.sg"
support-1 | }
support-1 | [08:59:33.272] INFO (56): Domain does not have any AAAA records.
support-1 | module: "formsgSiteLaunch"
support-1 | meta: {
support-1 | "domain": "dontexist.sg"
support-1 | }
Problem
There was a bug in the implementation of #1355. This worked for sites that were already launched. Newer sites which do no resolve to any host name throws a
ENOTFOUND
, which should be an ok error.Solution
To fix this issue, we explicitly check for this error code as well to ensure that this does not error out.
Breaking Changes
Tests
tldr; below we are testing for
Locally enter these values into
support/routes/v2/formsg/index.ts
assert that the console log outputs