Skip to content

Commit

Permalink
fix: fix crash when resolving non-A records from redis.
Browse files Browse the repository at this point in the history
  • Loading branch information
zicklag committed Nov 6, 2024
1 parent 989f4fa commit 84383de
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/dns/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ export async function startDnsServer() {
const resolveFromRedis = async () => {
// If there is not a CNAME record at for this domain, check for A records
const redisKey = REDIS_DNS_RECORD_PREFIX + type + ':' + name.toLowerCase();
if (type == 'CNAME' && isApex) {
return;
}
record = await redis.get(redisKey);
if (record) {
try {
Expand Down Expand Up @@ -283,10 +286,10 @@ export async function startDnsServer() {
console.warn('Error parsing DNS record from redis:', redisKey, record, e);
}
} else {
resolveFromRedis();
await resolveFromRedis();
}
} else {
resolveFromRedis();
await resolveFromRedis();
}

next();
Expand Down

0 comments on commit 84383de

Please sign in to comment.