question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError [ERR_INVALID_ARG_TYPE]: The "options.lookup" property must be of type function. Received null

See original GitHub issue
OS: Windows 10 21H2 19044.1469
superagent: 7.1.0

package.json

{
  ...
  "dependencies": {
    "superagent": "^7.1.0"
  },
  ...
}

test.js

const { get } = require('superagent')

get("http://www.baidu.com", (err, res) => {
  if (err) throw err
  console.log(res.statusCode)
})

output:

$ node .\test.js                                                                                ─╯
node:internal/validators:237
    throw new ERR_INVALID_ARG_TYPE(name, 'Function', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "options.lookup" property must be of type function. Received null
    at lookupAndConnect (node:net:1032:5)
    at Socket.connect (node:net:989:5)
    at Agent.connect [as createConnection] (node:net:203:17)
    at Agent.createSocket (node:_http_agent:341:26)
    at Agent.addRequest (node:_http_agent:292:10)
    at new ClientRequest (node:_http_client:305:16)
    at Object.request (node:http:96:10)
    at Request.request (K:\git\live-stream\node_modules\superagent\lib\node\index.js:833:18)
    at Request.end (K:\git\live-stream\node_modules\superagent\lib\node\index.js:989:8)
    at request.<computed> (K:\git\live-stream\node_modules\superagent\lib\node\index.js:1371:24) {
  code: 'ERR_INVALID_ARG_TYPE'
}

After downgrading to 6.1.0 there is no such issue:

$ node .\test.js
200

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:6

github_iconTop GitHub Comments

2reactions
niftylettucecommented, Jan 19, 2022
0reactions
adamkdeancommented, Jan 19, 2022

Thank goodness for this. I’ve been racking my brain trying to work out what’s going on today, where using a local version of a package was fine but the npm version was failing. Was just about to give up when I saw the npm WARN.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ERR_INVALID_ARG_TYPE · Issue #22630 · nodejs/node
TypeError [ERR_INVALID_ARG_TYPE]: The "options.cwd" property must be of type string. Received function wrappedCwd
Read more >
The "path" argument must be of type string ... - Stack Overflow
I'm working on a project in React and ran into a problem that has me stumped. Whenever I run yarn start I get...
Read more >
typeerror [err_invalid_arg_type]: the "data" argument must be ...
I get this error - TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of type string or an instance of Buffer, TypedArray, DataView, or...
Read more >
Uncaught TypeError: Cannot read property of undefined In
JavaScript TypeError is thrown when an operand or argument passed to a function is incompatible with the type expected by that operator or...
Read more >
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument ...
AssertionError: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found