moonrepo / proto

A pluggable multi-language version manager.
https://moonrepo.dev/proto
MIT License
631 stars 30 forks source link

Proto plugin network not follow proto settings.http proxies #564

Closed AiHMin closed 3 weeks ago

AiHMin commented 1 month ago

What version?

0.39.0

Which command?

proto install node 20

What happened?

I configured [settings.http] proxies in ~/.proto/config.toml I noticed that the proto install command only follows the proxy settings when fetching plugins, but not when executing plugin to install tools

e.g. I run proto install node 20 --log trace, it raised Connection Failed

Trace logs?

[DEBUG 2024-07-26 11:27:22.071] proto  Running proto v0.39.0  bin="proto" args=["install", "node", "16", "--log", "trace"] pid=60693
[TRACE 11:27:22.072] starbase::app  Running startup phase
[DEBUG 11:27:22.072] proto_core::proto  Creating proto environment, detecting store  store="/Users/am/.proto"
[TRACE 11:27:22.072] starbase::app  Running analyze phase
[TRACE 11:27:22.072] proto_core::proto_config  Traversing upwards and loading .prototools files
[DEBUG 11:27:22.072] proto_core::proto_config  Loading .prototools  file="/Users/am/.prototools"
[TRACE 11:27:22.072] starbase_utils::fs  Reading file  file="/Users/am/.prototools"
[TRACE 11:27:22.072] schematic::config::loader  Loading partial configuration  config="ProtoConfig"
[TRACE 11:27:22.072] schematic::config::loader  Creating layer from source  config="ProtoConfig" source="<code>"
[TRACE 11:27:22.072] schematic::config::loader  Merging partial layers into a final result  config="ProtoConfig"
[DEBUG 11:27:22.072] proto_core::proto_config  Loading .prototools  file="/Users/am/.proto/.prototools"
[TRACE 11:27:22.072] starbase_utils::fs  Opening file  file="/Users/am/.proto/.prototools"
[TRACE 11:27:22.072] starbase_utils::fs_lock  Locking file  file="/Users/am/.proto/.prototools"
[TRACE 11:27:22.073] starbase_utils::fs_lock  Unlocking file  file="/Users/am/.proto/.prototools"
[TRACE 11:27:22.073] schematic::config::loader  Loading partial configuration  config="ProtoConfig"
[TRACE 11:27:22.073] schematic::config::loader  Creating layer from source  config="ProtoConfig" source="<code>"
[TRACE 11:27:22.073] schematic::config::loader  Merging partial layers into a final result  config="ProtoConfig"
[DEBUG 11:27:22.073] proto_core::proto_config  Merging loaded configs
[DEBUG 11:27:22.073] proto_core::proto_config  Merged 2 configs
[TRACE 11:27:22.073] starbase_utils::net  Checking for an internet connection  timeout=750
[TRACE 11:27:22.073] starbase_utils::net::offline  Resolving 1.1.1.1:53
[TRACE 11:27:22.370] starbase_utils::net  Online!
[DEBUG 11:27:22.370] proto_core::proto_config  Merging loaded configs without global
[DEBUG 11:27:22.370] proto_core::proto_config  Merged 1 configs
[TRACE 11:27:22.371] starbase::app  Running execute phase
[TRACE 11:27:22.372] starbase_utils::fs  Reading file  file="/Users/am/.proto/temp/.last-version-check"
[DEBUG 11:27:22.372] proto::commands::install  Loading tool  id="node"
[DEBUG 11:27:22.372] proto_core::tool_loader  Finding a configured plugin  tool="node"
[DEBUG 11:27:22.372] proto_core::tool_loader  Using a built-in plugin  plugin="https://github.com/moonrepo/tools/releases/download/node_tool-v0.11.6/node_tool.wasm"
[TRACE 11:27:22.373] warpgate::loader  Creating plugin loader  cache_dir="/Users/am/.proto/plugins"
[TRACE 11:27:22.373] warpgate::loader  Loading plugin node  id="node"
[TRACE 11:27:22.373] starbase_utils::fs  Reading file metadata  file="/Users/am/.proto/plugins/node-a15e0916dd4e51ceb9af2be427e6c9a05f126cf6ac695cd9253e66476c9f2db2.wasm"
[TRACE 11:27:22.373] warpgate::loader  Plugin already downloaded and cached  id="node" path="/Users/am/.proto/plugins/node-a15e0916dd4e51ceb9af2be427e6c9a05f126cf6ac695cd9253e66476c9f2db2.wasm"
[DEBUG 11:27:22.373] proto_core::tool_loader  Loading WASM plugin  source="/Users/am/.proto/plugins/node-a15e0916dd4e51ceb9af2be427e6c9a05f126cf6ac695cd9253e66476c9f2db2.wasm"
[TRACE 11:27:22.373] warpgate::plugin  Storing plugin identifier  id="node"
[TRACE 11:27:22.373] warpgate::plugin  Storing host environment  env={"arch":"arm64","libc":"gnu","os":"macos","home_dir":{"path":"/userhome/","virtual_prefix":"/userhome","real_prefix":"/Users/am"}}
[TRACE 11:27:22.373] starbase_utils::json  Formatting JSON
[TRACE 11:27:22.373] proto_core::tool_loader  Storing proto tool configuration  config={"bundled-npm":true,"dist-url":"https://mirrors.tuna.tsinghua.edu.cn/nodejs-release"}
[DEBUG 11:27:22.373] proto_core::tool  Creating tool node and instantiating plugin
[TRACE 11:27:22.395] warpgate::plugin  Created plugin container  id="node" plugin="b3309752-c21b-40b0-8afe-57253ed6ef3a"
[DEBUG 11:27:22.395] proto_core::tool  Created tool node and its WASM runtime
[TRACE 11:27:22.395] warpgate::plugin  Calling plugin function register_tool  id="node" plugin="b3309752-c21b-40b0-8afe-57253ed6ef3a" input={"id":"node"}
[TRACE 11:27:22.395] warpgate::plugin  Called plugin function register_tool  id="node" plugin="b3309752-c21b-40b0-8afe-57253ed6ef3a" output={"inventory":{},"name":"Node.js","plugin_version":"0.11.6","type":"Language"}
[DEBUG 11:27:22.395] proto_core::tool_manifest  Loading manifest.json  file="/Users/am/.proto/tools/node/manifest.json"
[TRACE 11:27:22.395] starbase_utils::fs  Opening file  file="/Users/am/.proto/tools/node/manifest.json"
[TRACE 11:27:22.395] starbase_utils::fs_lock  Locking file  file="/Users/am/.proto/tools/node/manifest.json"
[TRACE 11:27:22.396] starbase_utils::fs_lock  Unlocking file  file="/Users/am/.proto/tools/node/manifest.json"
[DEBUG 11:27:22.396] proto_core::tool  Resolving a semantic version or alias  tool="node" initial_version="~16"
[DEBUG 11:27:22.396] proto_core::tool  Loading available versions  tool="node"
[TRACE 11:27:22.397] warpgate::plugin  Calling plugin function load_versions  id="node" plugin="b3309752-c21b-40b0-8afe-57253ed6ef3a" input={"initial":"~16"}
[DEBUG 11:27:22.397] extism::pdk  Fetching https://nodejs.org/download/release/index.json  plugin="b3309752-c21b-40b0-8afe-57253ed6ef3a"
[TRACE 11:27:39.262] starbase::app  Running shutdown phase (because another phase failed)
Error: plugin::call_func::failed

  × https://nodejs.org/download/release/index.json: Connection Failed: tls connection init failed: Connection reset by peer (os error 54)

Operating system?

MacOS

Architecture?

arm64

milesj commented 1 month ago

HTTP requests that occur within WASM itself do not use the [settings.http] because they are handled by different libraries/runtimes. This is something on my list to resolve.

milesj commented 3 weeks ago

Fixed in 0.40.