The "options.agent" property must be one of type Agent-like Object, undefined, or false.
See original GitHub issueWhen I try to install minecraft jar with @xmcl/installer
, I get the following error but not all the times:
GotError: The "options.agent" property must be one of type Agent-like Object, undefined, or false. Received type object
I only get this error in a linux environment (which is sandboxed in a docker environment) or when I test my launcher with spectron
which is also sandboxed.
My guess is that it has something to do with these lines: https://github.com/Voxelum/minecraft-launcher-core-node/blob/a034fba5c1f6c04afe06f36f29f1dc132c1f5a95/packages/installer/util.ts#L92-L102 However, when I do the following, I don’t get any error:
const got = require("got")
const HttpAgent = require("agentkeepalive")
const { HttpsAgent } = HttpAgent;
await got("https://www.google.com", {
agent: {
http: new HttpAgent(),
https: new HttpsAgent()
}
).text();
But if I replace https: new HttpsAgent()
with https: new Object()
, I get the same error. There must be some conditional agent in the code that I am not aware of that is causing this issue.
Issue Analytics
- State:
- Created 3 years ago
- Comments:19 (14 by maintainers)
Top Results From Across the Web
The "options.agent" property must be one of type Agent-like ...
TypeError [ERR_INVALID_ARG_TYPE]: The "options.agent" property must be one of type Agent-like Object, undefined, or false. Received type ...
Read more >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 >The "options.agent" property must be one of type Agent-like Object ...
The "options.agent" property must be one of type Agent-like Object, undefined, or false. Received type function.
Read more >Can't use agent in beforeHook #1292 - Issuehunt
RequestError : The "options.agent" property must be one of type Agent-like Object, undefined or false. Received object at l.
Read more >ccxt-dev/ccxt - Gitter
The idea is that it would be subscription based however $1k a month for just ... property must be one of type Agent-like...
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
In fact, this issue was caused by another one: https://github.com/electron/electron/issues/22119. I am still going to leave this issue open because they seem like two different problems.
That might be a problem of compatibility of sandbox… but I cannot come up a reason…
The error
is actually thrown by nodejs not got.
I don’t think I swap the agent by condition in my code… at least I don’t remember I have a conditional agent. So it might be a problem of got.
The only place to swap agent in got is here. Maybe you can place some breakpoint there to debug? (Or modify the js file in node_modules and print…)