You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: fail fast on transient DB errors in custom domain verification
https://linear.app/speakeasy/issue/AGE-1630/bug-do-not-create-domains-on-transient-lookup-errors
Previously, any error from `GetCustomDomainByDomain` triggered domain
creation. Now only `pgx.ErrNoRows` does — other errors (e.g. connection
failures) return immediately instead of creating spurious domain records.
Also extracts DNS lookups into a `dns.Resolver` interface to enable
unit testing, and adds 13 tests covering domain creation, error handling,
DNS verification, and the transient error fix.
returnoops.E(oops.CodeUnauthorized, errors.New("custom domain does not belong to organization"), "custom domain does not belong to organization").Log(ctx, d.logger)
99
112
}
100
113
101
-
cname, err:=net.LookupCNAME(domain.Domain)
114
+
cname, err:=d.resolver.LookupCNAME(domain.Domain)
102
115
iferr!=nil {
103
116
d.logger.InfoContext(ctx, "CNAME lookup failed for domain", attr.SlogURLDomain(domain.Domain), attr.SlogError(err))
104
117
// Provide more info if an A record exists
105
-
ips, aErr:=net.LookupHost(domain.Domain)
118
+
ips, aErr:=d.resolver.LookupHost(domain.Domain)
106
119
ifaErr==nil&&len(ips) >0 {
107
120
d.logger.InfoContext(ctx, fmt.Sprintf("CNAME not found. Found A record(s): %s", strings.Join(ips, ", ")))
0 commit comments