Skip to content

Commit 13e8f68

Browse files
authored
Updates dns docs to not use unimplemented method (#19564)
1 parent b32e43b commit 13e8f68

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/content/changelogs-next/2025-01-28-nodejs-compat-improvements.mdx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,9 @@ You can use [`node:dns`](https://nodejs.org/api/dns.html) for name resolution vi
5353

5454
<TypeScriptExample filename="index.ts">
5555
```ts
56-
import dns from "node:dns";
56+
import dns from 'node:dns';
5757
58-
dns.lookup("example.org", (_err: any, address: string, ipFamily: number) =>
59-
console.log(`address: ${address} family: IPv${ipFamily}`));
58+
let responese = await dns.promises.resolve4('cloudflare.com', 'NS');
6059
````
6160
6261
</TypeScriptExample>

src/content/docs/workers/runtime-apis/nodejs/dns.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ You can use [`node:dns`](https://nodejs.org/api/dns.html) for name resolution vi
1212

1313
<TypeScriptExample filename="index.ts">
1414
```ts
15-
import dns from "node:dns";
15+
import dns from 'node:dns';
1616

17-
dns.lookup("example.org", (_err: any, address: string, ipFamily: number) =>
18-
console.log(`address: ${address} family: IPv${ipFamily}`));
17+
let responese = await dns.promises.resolve4('cloudflare.com', 'NS');
1918
```
2019
</TypeScriptExample>
2120

21+
All `node:dns` functions are available, except `lookup`, `lookupService`, and `resolve` which throw "Not implemented" errors when called.
22+
2223
:::note
2324

2425
DNS requests will execute a subrequest, counts for your [Worker's subrequest limit](/workers/platform/limits/#subrequests).

0 commit comments

Comments
 (0)