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.

The "options.agent" property must be one of type Agent-like Object, undefined, or false.

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:19 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
lukechu10commented, Mar 27, 2020

Sorry for so many comments but in fact, it turns out that the task install.installVersion hangs if the version folder exists and the version json file exists but is empty.

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.

1reaction
ci010commented, Mar 24, 2020

That might be a problem of compatibility of sandbox… but I cannot come up a reason…

The error

The “options.agent” property must be one of type Agent-like Object, undefined, or false. Received type object

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…)

Read more comments on GitHub >

github_iconTop 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 >

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