nutshimit / mashin

Mashin is an extensible rust-powered Infrastructure as Code (IaC) platform with a Javascript runtime, simplifying cloud resource management through a seamless combination of custom providers and expressive scripting.
https://mashin.land
MIT License
20 stars 2 forks source link

Error running on windows. #51

Open tensor-programming opened 1 year ago

tensor-programming commented 1 year ago

Is there an existing issue?

General Was attempting to run the program.

Context Error occurs when trying to run both locally and also against a web source. Also, the official example provider seemingly has its mod.ts missing because it was included in the gitignore. Not sure if this was deliberate.

Stacktrace

Platform: windows x86_64
Version: 0.1.7
Args: ["mashin", "run", "https://raw.githubusercontent.com/tensor-programming/mashing-test/dev/examples/my_provider.ts"]

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Builder, source: "Unknown TLS backend passed to `use_preconfigured_tls`" }', c:\Users\jking\.cargo\registry\src\github.com-1ecc6299db9ec823\deno_fetch-0.128.0\lib.rs:703:22
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library\std\src\panicking.rs:575
   1: core::panicking::panic_fmt
             at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library\core\src\panicking.rs:64
   2: core::result::unwrap_failed
             at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library\core\src\result.rs:1790
   3: deno_fetch::create_http_client
   4: mashin::http_client::HttpClient::new
   5: mashin::main::{{closure}}
   6: tokio::runtime::scheduler::current_thread::Context::enter
   7: tokio::macros::scoped_tls::ScopedKey<T>::set
   8: tokio::runtime::scheduler::current_thread::CurrentThread::block_on
   9: tokio::runtime::runtime::Runtime::block_on
  10: mashin::setup_panic_hook::{{closure}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Additional Information

Can be recreated on windows by executing mashin run on a provider that is local or remote.

Solution No response

Are you willing to help with this request? Yes, I can help with this if needed.

tensor-programming commented 1 year ago

Fixed by bumping up these deps:

deno_core = "0.187.0"
deno_web = "0.136.0"
deno_fetch = "0.129.0"
deno_console = "0.105.0"
deno_webidl = "0.105.0"
deno_url = "0.105.0"
deno_websocket = "0.110.0"

Leads to another error however,

Error: Error: Could not open library: The specified module could not be found.
    at new DynamicProvider (ext:mashin_core/40_ffi.js:14:9)
    at new Provider (https://mashin.run/std@0.1.0/sdk/resource.ts:20:9)
    at new Provider (https://raw.githubusercontent.com/tensor-programming/mashing-test/dev/mod.ts:35:9)
    at https://raw.githubusercontent.com/tensor-programming/mashing-test/dev/examples/my_provider.ts:4:18
    at eventLoopTick (ext:core/01_core.js:181:11)
tensor-programming commented 1 year ago

I found the issue overall with windows. I was able to run both my_provider.ts and my_provider_x500.ts by manually modifying the mod.ts file and replacing the LOCAL_PATH with a direct path to the .dll file for the lib.

On windows the files created for a cdylib are .dll and not .dynlib or .so files. Also for some reason, instead of appending lib in front of the name of the file, they just use the project name directly. As seen below.

image

The header here https://github.com/nutshimit/mashin/blob/d3f0fe6bc3d0234ce265fdd39dcc9f50109bf12d/cli/src/tools/bindgen.rs#L107-L144 will have to be conditionally compiled for windows.