Stream: general

Topic: ✔ getting error "fields has the wrong type"


view this post on Zulip Rajat Jindal (Jul 04 2024 at 06:08):

I am trying to run a cli component using wasmtime, which has following wit file:

package foo:bar@0.1.0;

world cli {
  include wasi:cli/imports@0.2.0;
  import wasi:http/outgoing-handler@0.2.0;
  export wasi:cli/run@0.2.0;
}

and a simple main function that makes an outbound request (I am using tinygo for it).

When I run it, I get following error:

Error: failed to run main module `main.wasm`

Caused by:
    0: component imports instance `wasi:http/types@0.2.0`, but a matching implementation was not found in the linker
    1: instance export `fields` has the wrong type
    2: resource implementation is missing

Any pointers on what I might be missing here.

Thanks

view this post on Zulip Rajat Jindal (Jul 04 2024 at 07:38):

I just tried this with rust and ran into same problem.

view this post on Zulip Rajat Jindal (Jul 04 2024 at 07:44):

i found a similar comment here: https://github.com/bytecodealliance/wasi-rs/issues/87#issuecomment-2099616901

but i am trying to run a cli command that makes an outbound http request.

I tried with -Scli and -Shttp, but none of them helped

Hi, I'm trying to build the examples here for the wasm32-wasip2 target. The cli-command example works fine, but the http-proxy example fails while linking with module does not export a function nam...

view this post on Zulip Rajat Jindal (Jul 04 2024 at 08:29):

nevermind, found the issue. I was running wasmtime run main.wasm -Shttp while I should have used wasmtime run -Shttp main.wasm

The position of -Shttp mattered.

view this post on Zulip Notification Bot (Jul 04 2024 at 08:29):

Rajat Jindal has marked this topic as resolved.


Last updated: Nov 22 2024 at 16:03 UTC