Fix dns.resolve() with 'PTR' throws Error: Unknown type "PTR" #1038

wants to merge 2 commits into


None yet

3 participants


In API docs, dns.resolve() supports 'PTR' record type, but it throws Error: Unknown type "PTR".


$ node
> require('dns').resolve('', 'PTR', console.log);
Error: Unknown type "PTR"
    at Object.resolve (dns.js:109:11)
    at [object Context]:1:16
    at Interface.<anonymous> (repl.js:171:22)
    at Interface.emit (events.js:64:17)
    at Interface._onLine (readline.js:153:10)
    at Interface._line (readline.js:408:8)
    at Interface._ttyWrite (readline.js:585:14)
    at ReadStream.<anonymous> (readline.js:73:12)
    at ReadStream.emit (events.js:81:20)
    at ReadStream._emitKey (tty_posix.js:307:10)

This change is the same as:

ry commented May 14, 2011

test does not pass on my machine. is there another way of testing this.
% ./node test/simple/test-c-ares.js
[ '' ]
[ '' ]

  throw new assert.AssertionError({
AssertionError: 1 == 0
    at /Users/ryan/projects/node/test/simple/test-c-ares.js:64:10
    at dns.js:232:11
    at Object.resolve (dns.js:107:5)
    at Object.<anonymous> (/Users/ryan/projects/node/test/simple/test-c-ares.js:62:5)
    at Module._compile (module.js:407:26)
    at Object..js (module.js:413:10)
    at Module.load (module.js:339:31)
    at Function._load (module.js:298:12)
    at Array.0 (module.js:426:10)
    at EventEmitter._tickCallback (node.js:126:26)

Looks like only one of the NS servers (the first one,, returns 86400 IN PTR localhost.
the others return no records (and there is no NS record for

Of course resolving with libc returns localhost as it is probably listed in /etc/hosts.


I changed the test, please try it again.

ry commented May 16, 2011

that fixed it. thanks

@ry ry closed this in d4f82ea May 16, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment