| [ Web Proxy ] |
| Viewing: https://developers.cloudflare.com/workers/runtime-apis/nodejs/dns/ | [Back] [Original] |
Note
For compatibility dates of 2026-08-04 or later, Workers enables both nodejs_compat and nodejs_compat_v2 by default. These flags are not used for these compatibility dates. Existing projects do not need to remove them when updating their compatibility date. For earlier dates, add nodejs_compat to your Wrangler configuration file to opt in. For instructions to turn off Node.js compatibility, refer to the Node.js compatibility flag.
You can use node:dns for name resolution via DNS over HTTPS using
Cloudflare DNS at 1.1.1.1.
import dns from "node:dns";
let response = await dns.promises.resolve4("cloudflare.com", "NS");import dns from 'node:dns';
let response = await dns.promises.resolve4('cloudflare.com', 'NS');All node:dns functions are available, except lookup, lookupService, and resolve which throw "Not implemented" errors when called.
Note
DNS requests will execute a subrequest, counts for your Worker's subrequest limit.
The full node:dns API is documented in the Node.js documentation for node:dns .
| Web Proxy Viewer | New URL | Original Page |