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 issuehttpAgent 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:
- Created 5 years ago
- Comments:6
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any possibility of getting this working with defaults as opposed to having to create an instance?
Same error. Tried:
got
The "options.agent" property must be one of type Agent-like
Replaced with:
which works but first is more convenient so I’d like to have this fixed.