minecraft-launcher-core-node: The "options.agent" property must be one of type Agent-like Object, undefined, or false.
When 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.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 19 (14 by maintainers)
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…)