Problem
src/user/nip05.ts uses a hardcoded console.error when a NIP-05 fetch fails:
} catch (_e) {
ndk?.cacheAdapter?.saveNip05(fullname, null);
console.error("Failed to fetch NIP05 for", fullname, _e);
return null;
}
This fires unconditionally on any network failure — unreachable domain, CORS error, timeout — and cannot be silenced without monkey-patching console.error. NIP-05 fetch failures are expected behavior (many Nostr users have unreachable or expired NIP-05 domains), so logging them as errors inflates console noise and confuses application developers who have no way to opt out.
Expected behavior
The rest of NDK uses the debug package consistently (e.g. relay connectivity, subscriptions, authentication). The nip05.ts module is the only place that breaks this pattern with a bare console.error.
Proposed fix
Add a debug instance scoped to ndk:nip05 and replace the console.error:
import debug from "debug";
const d = debug("ndk:nip05");
// in the catch block:
d("Failed to fetch NIP05 for %s: %O", fullname, _e);
This makes the log silent by default and opt-in via DEBUG=ndk:nip05 — consistent with how every other NDK module handles internal errors.
Impact
- Zero behavior change: the function still returns
null and saves a negative cache entry.
- Developers can enable
DEBUG=ndk:nip05 when they need to trace NIP-05 resolution issues.
- Eliminates unavoidable console noise in applications that verify NIP-05 identifiers at scale (e.g. badge grids, feed profiles).
NDK version
Reproduced on @nostr-dev-kit/ndk@3.0.3.
Problem
src/user/nip05.tsuses a hardcodedconsole.errorwhen a NIP-05 fetch fails:This fires unconditionally on any network failure — unreachable domain, CORS error, timeout — and cannot be silenced without monkey-patching
console.error. NIP-05 fetch failures are expected behavior (many Nostr users have unreachable or expired NIP-05 domains), so logging them as errors inflates console noise and confuses application developers who have no way to opt out.Expected behavior
The rest of NDK uses the
debugpackage consistently (e.g. relay connectivity, subscriptions, authentication). Thenip05.tsmodule is the only place that breaks this pattern with a bareconsole.error.Proposed fix
Add a
debuginstance scoped tondk:nip05and replace theconsole.error:This makes the log silent by default and opt-in via
DEBUG=ndk:nip05— consistent with how every other NDK module handles internal errors.Impact
nulland saves a negative cache entry.DEBUG=ndk:nip05when they need to trace NIP-05 resolution issues.NDK version
Reproduced on
@nostr-dev-kit/ndk@3.0.3.