Gi
Gi•7d ago

lookupService is not a function

Hello. I was looking to rewrite a small NodeJS app with Deno2 to simplify the setup. It uses the node-opcua npm package. but when I import it, it throws an error.
error: Uncaught (in promise) TypeError: dns_1.default.lookupService is not a function
at GetAddrInfoReqWrap.callback (file:///home/aw/.cache/deno/npm/registry.npmjs.org/node-opcua-hostname/2.128.0/dist/hostname.js:29:23)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:39:8)
at ext:deno_node/internal_binding/cares_wrap.ts:78:9
at eventLoopTick (ext:core/01_core.js:175:7)
error: Uncaught (in promise) TypeError: dns_1.default.lookupService is not a function
at GetAddrInfoReqWrap.callback (file:///home/aw/.cache/deno/npm/registry.npmjs.org/node-opcua-hostname/2.128.0/dist/hostname.js:29:23)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:39:8)
at ext:deno_node/internal_binding/cares_wrap.ts:78:9
at eventLoopTick (ext:core/01_core.js:175:7)
Package was added with deno add npm:node-opcua. This is the deno.json
{
"tasks": {
"dev": "deno run --watch --env=.env -A src/main.ts"
},
"imports": {
"@std/assert": "jsr:@std/assert@1",
"@std/fmt": "jsr:@std/fmt@^1.0.2",
"@std/log": "jsr:@std/log@^0.224.9",
"@t3-oss/env-core": "npm:@t3-oss/env-core@^0.11.1",
"node-opcua": "npm:node-opcua@^2.133.0",
"zod": "npm:zod@^3.23.8"
}
}
{
"tasks": {
"dev": "deno run --watch --env=.env -A src/main.ts"
},
"imports": {
"@std/assert": "jsr:@std/assert@1",
"@std/fmt": "jsr:@std/fmt@^1.0.2",
"@std/log": "jsr:@std/log@^0.224.9",
"@t3-oss/env-core": "npm:@t3-oss/env-core@^0.11.1",
"node-opcua": "npm:node-opcua@^2.133.0",
"zod": "npm:zod@^3.23.8"
}
}
main.ts looks like this
import { LogLevel, setLogLevel } from "node-opcua";

// OPC-UA logger (default is LogLevel.Warning);
setLogLevel(LogLevel.Error);
import { LogLevel, setLogLevel } from "node-opcua";

// OPC-UA logger (default is LogLevel.Warning);
setLogLevel(LogLevel.Error);
Any thoughts?
2 Replies
marvinh.
marvinh.•7d ago
Looks like a bug. I've filed an issue for that https://github.com/denoland/deno/issues/26300
Gi
Gi•7d ago
Ah, thank you 🙃