Description
FYI I'm loving the componentize-go.toml change, it really cleans up some of my Go projects!
I've run into a little issue where my sdk's wit incorrectly merges with the local WIT.
Reproduction
I currently have the following wit defined in my sdk:
world sdk {
include wasi:http/proxy@0.2.0;
...
}
In my local wit I add some extra features, but it also re-defines the wasi:http/outgoing-handler:
world bat {
import wasi:http/outgoing-handler@0.2.0;
...
}
After building and running I get the following error from wasmtime:
$ componentize-go --world bat --wit-path ./wit build --output build/hello.wasm
$ wasmtime serve --addr 0.0.0.0:8000 -Scli build/hello.wasm
Starting wasmtime
Error: no exported instance named `wasi:http/incoming-handler@0.2.6`
Inspecting the built wasm results in the following:
$ wash inspect build/hello.wasm
package root:component;
world root {
import wasi:io/poll@0.2.6;
import wasi:clocks/monotonic-clock@0.2.6;
import wasi:io/error@0.2.6;
import wasi:io/streams@0.2.6;
import wasi:http/types@0.2.0;
import wasi:http/outgoing-handler@0.2.0;
import wasi:cli/environment@0.2.6;
import wasi:cli/exit@0.2.6;
import wasi:cli/stdin@0.2.6;
import wasi:cli/stdout@0.2.6;
import wasi:cli/stderr@0.2.6;
import wasi:cli/terminal-input@0.2.6;
import wasi:cli/terminal-output@0.2.6;
import wasi:cli/terminal-stdin@0.2.6;
import wasi:cli/terminal-stdout@0.2.6;
import wasi:cli/terminal-stderr@0.2.6;
import wasi:clocks/wall-clock@0.2.6;
import wasi:filesystem/types@0.2.6;
import wasi:filesystem/preopens@0.2.6;
import wasi:random/random@0.2.6;
}
It seems to have included the import wasi:http/outgoing-handler@0.2.0 but missed out the export wasi:http/incoming-handler@0.2.0.
Troubleshooting:
- I have tried both using
include wasi:http/proxy@0.2.0; defining both incoming-handler and outgoing-handler
- Removing the
outgoing-handler in the local wit fixes the issue (sdk wit is correctly used)
Description
FYI I'm loving the
componentize-go.tomlchange, it really cleans up some of my Go projects!I've run into a little issue where my sdk's wit incorrectly merges with the local WIT.
Reproduction
I currently have the following wit defined in my sdk:
In my local wit I add some extra features, but it also re-defines the
wasi:http/outgoing-handler:After building and running I get the following error from wasmtime:
$ componentize-go --world bat --wit-path ./wit build --output build/hello.wasm $ wasmtime serve --addr 0.0.0.0:8000 -Scli build/hello.wasm Starting wasmtime Error: no exported instance named `wasi:http/incoming-handler@0.2.6`Inspecting the built wasm results in the following:
It seems to have included the
import wasi:http/outgoing-handler@0.2.0but missed out theexport wasi:http/incoming-handler@0.2.0.Troubleshooting:
include wasi:http/proxy@0.2.0;defining bothincoming-handlerandoutgoing-handleroutgoing-handlerin the local wit fixes the issue (sdk wit is correctly used)