DevelopingSpace / starchart

A self-serve tool for managing custom domains and certificates
MIT License
20 stars 13 forks source link

DNS Record delete flow breaks expectations of notifications db logic #455

Closed humphd closed 1 year ago

humphd commented 1 year ago

When we delete a record, the notifications code tries to get details about the record from the database, but the record has already been removed and it fails.

For example, we deleted DNS Record with id=4 successfully, but it then fails to find it:

Notification job failed, unable add notification for failed DNS record id=4 Could not get DNS Record with id=4

This makes sense (it should fail to find a deleted record). So the logic is wrong here.

starchart_mycustomdomain.1.f4todbr086mt@cudm-mgmt01dv.dcm.senecacollege.ca    | {"level":"debug","message":"Route53 DNS change: delete emailtest.davidhumphrey.stage.mystudentproject.ca=192.168.2.1 with type=A for user=david.humphrey","timestamp":"2023-03-27T14:11:16.542Z"}
starchart_mycustomdomain.1.f4todbr086mt@cudm-mgmt01dv.dcm.senecacollege.ca    | {"level":"debug","message":"Checking status of Route53 DNS Change /change/C02843391JA25XXK3Z868","timestamp":"2023-03-27T14:11:17.060Z"}
starchart_mycustomdomain.1.f4todbr086mt@cudm-mgmt01dv.dcm.senecacollege.ca    | {"level":"debug","message":"dns-worker started","timestamp":"2023-03-27T14:11:27.378Z"}
starchart_mycustomdomain.1.f4todbr086mt@cudm-mgmt01dv.dcm.senecacollege.ca    | {"level":"debug","message":"Checking status of Route53 DNS Change /change/C02843391JA25XXK3Z868","timestamp":"2023-03-27T14:11:27.379Z"}
starchart_mycustomdomain.1.f4todbr086mt@cudm-mgmt01dv.dcm.senecacollege.ca    | {"level":"debug","message":"dns-worker started","timestamp":"2023-03-27T14:11:47.756Z"}
starchart_mycustomdomain.1.f4todbr086mt@cudm-mgmt01dv.dcm.senecacollege.ca    | {"level":"debug","message":"Checking status of Route53 DNS Change /change/C02843391JA25XXK3Z868","timestamp":"2023-03-27T14:11:47.756Z"}
starchart_mycustomdomain.1.f4todbr086mt@cudm-mgmt01dv.dcm.senecacollege.ca    | {"level":"debug","message":"Syncing DNS record id=4 with DNS status=INSYNC to database","timestamp":"2023-03-27T14:11:48.156Z"}
starchart_mycustomdomain.1.f4todbr086mt@cudm-mgmt01dv.dcm.senecacollege.ca    | {"level":"error","message":"Notification job failed, unable add notification for failed DNS record id=4 Could not get DNS Record with id=4","stack":"Error: Could not get DNS Record with id=4\n    at sendDnsRecordStatusUpdateNotification (/app/build/index.js:1116:13)\n    at QueueEvents.<anonymous> (/app/build/index.js:1158:9)","timestamp":"2023-03-27T14:11:48.183Z"}
humphd commented 1 year ago

This isn't an issue now with the reconciler.