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.agent" property must be one of type Agent-like Object, undefined, or false. Received type object

See original GitHub issue

httpAgent seem doesn’t work

my configure

const Agent = require('agentkeepalive') const keepaliveAgent = new Agent({ maxSockets: 100, maxFreeSockets: 10, timeout: 60000, freeSocketKeepAliveTimeout: 30000 // free socket keepalive for 30 seconds }) axios.defaults.httpAgent = keepaliveAgent

then console report error

TypeError [ERR_INVALID_ARG_TYPE]: The "options.agent" property must be one of type Agent-like Object, undefined, or false. Received type object at new ClientRequest (_http_client.js:102:11) at Object.request (http.js:41:10)

Context

  • axios version: v0.18.0
  • Environment: node v10.1.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

8reactions
iuioiuacommented, Oct 19, 2018

Any possibility of getting this working with defaults as opposed to having to create an instance?

6reactions
ivan-kleshnincommented, Jul 16, 2018

Same error. Tried:

 A.defaults.baseURL = `https://localhost:8080`
 A.defaults.httpsAgent = new HTTPS.Agent({
   keepAlive: true,
   rejectUnauthorized: false,
 })

got The "options.agent" property must be one of type Agent-like

Replaced with:

let axios = A.create({ ... })

which works but first is more convenient so I’d like to have this fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Expected the `options.agent` properties to be `http ...
I am trying to set a proxy in my Node.js code. I am using the GOT library of npm to make an API...
Read more >
mzabriskie/axios - Gitter
... option" argument must be one of type Agent-like Object, undefined, or false ... It's an option that's usually passed to tls.connect ,...
Read more >
cannot read properties of undefined (reading 'post') axios
I am trying to implement an axios request inside an express app to query an external API. I looks fine but when I...
Read more >
How to Avoid Getting 'Cannot read property of undefined' in ...
One of the most common type errors in JavaScript is the famous "Cannot read ... Since undefined is not an object, you will...
Read more >
Top 5 agentkeepalive Code Examples - Snyk
To help you get started, we've selected a few agentkeepalive examples, ... data to write to the request, default: undefined * * @param...
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