Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
thep0y opened this issue Jan 19, 2022 · 6 comments

Comments

@thep0y
Copy link

thep0y commented Jan 19, 2022

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
@niftylettuce
Copy link
Collaborator

Thanks, just deprecated that latest release. Must have missed it in the tests. Will revert that commit and publish new version probably or try to fix per #1595

@apollyon600
Copy link

apollyon600 commented Jan 19, 2022

This just all of a sudden popped up as an error, I thought it was something I did but it turns out it was an internal error.
Spent the last 2 hours trying to figure out why this was happening.. (sadge)

Pre "options.lookup" error version:
npm i superagent@7.0.2

@alalaha
Copy link

alalaha commented Jan 19, 2022

oh man, fix this for the love of god
it's giving me a big headache

(or revert update to stable version until you fix it) there are many packages dependent on this

@bizob2828
Copy link

Thanks, just deprecated that latest release. Must have missed it in the tests. Will revert that commit and publish new version probably or try to fix per #1595

Thanks for deprecating @niftylettuce. Just FYI deprecating a package is nice because it provided a link to this but you also need to tag the previous released version(7.0.2) as latest, otherwise you'll still get 7.1.0 installed.

@niftylettuce
Copy link
Collaborator

v7.1.1 published

https://github.com/visionmedia/superagent/releases/tag/v7.1.1

@adamkdean
Copy link

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.

jsumners-nr pushed a commit to jsumners-nr/node-newrelic that referenced this issue Apr 11, 2024
jsumners-nr pushed a commit to jsumners-nr/node-newrelic that referenced this issue Apr 15, 2024
bizob2828 added a commit to newrelic/node-newrelic that referenced this issue Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants