From 743c0316a41a1c389cf0e201de9df658669b1466 Mon Sep 17 00:00:00 2001 From: alphaeusmote <41258468-alphaeusmote@users.noreply.replit.com> Date: Fri, 11 Apr 2025 14:38:47 +0000 Subject: [PATCH] Add logging statements to improve debugging of DNS record updates. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9111ef36-26c8-4085-84ca-a35dc1fec1b5 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7083d608-d6d3-4a6a-9a27-6286c5109627/6aad500b-ef65-4494-963b-957d713f20a2.jpg --- server/routes.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/server/routes.ts b/server/routes.ts index 7da8293..eef4c06 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -175,13 +175,18 @@ export async function registerRoutes(app: Express): Promise { const processedRecords = await Promise.all(records.map(async (record) => { // For A records with auto IP enabled, fetch the current IP if (record.isAutoIP && (record.type === 'A' || record.type === 'AAAA')) { + console.log(`Processing AutoIP record: ${record.id}, type: ${record.type}, name: ${record.name}`); try { // Get the appropriate IP address based on record type let currentIp = null; if (record.type === 'A') { + console.log(`Fetching IPv4 address for record ${record.id}`); currentIp = await getCurrentIpAddress(); + console.log(`Fetched IPv4 address: ${currentIp}`); } else if (record.type === 'AAAA') { + console.log(`Fetching IPv6 address for record ${record.id}`); currentIp = await getCurrentIpv6Address(); + console.log(`Fetched IPv6 address: ${currentIp}`); } if (currentIp) { @@ -216,21 +221,31 @@ export async function registerRoutes(app: Express): Promise { app.get("/api/dns-records/:id", requireRole(["admin", "manager", "user", "readonly"]), async (req, res) => { try { const recordId = req.params.id; + console.log(`Fetching DNS record with ID: ${recordId}`); + const record = await storage.getDnsRecord(recordId); if (!record) { + console.log(`DNS record not found with ID: ${recordId}`); return res.status(404).json({ message: "DNS record not found" }); } + console.log(`Found DNS record: ${JSON.stringify(record)}`); + // For A/AAAA records with auto IP enabled, fetch the current IP address if (record.isAutoIP && (record.type === 'A' || record.type === 'AAAA')) { + console.log(`Processing AutoIP record: ${record.id}, type: ${record.type}, name: ${record.name}`); try { // Get the appropriate IP address based on record type let currentIp = null; if (record.type === 'A') { + console.log(`Fetching IPv4 address for record ${record.id}`); currentIp = await getCurrentIpAddress(); + console.log(`Fetched IPv4 address: ${currentIp}`); } else if (record.type === 'AAAA') { + console.log(`Fetching IPv6 address for record ${record.id}`); currentIp = await getCurrentIpv6Address(); + console.log(`Fetched IPv6 address: ${currentIp}`); } if (currentIp) {