2

I am trying to create an Envoy filter using Golang WASM. As soon as I add the following import: "google.golang.org/protobuf/proto" And the following usage under OnHttpRequestBody:

func (ctx *setBodyContext) OnHttpRequestBody(bodySize int, endOfStream bool) types.Action {
    _ = proto.String("x")
    return types.ActionContinue
}

I get the following error during Envoy startup:

[source/extensions/common/wasm/wasm_vm.cc:38] Failed to load Wasm module due to a missing import: wasi_snapshot_preview1.fd_filestat_get

I am building using TinyGo: tinygo version 0.25.0 windows/amd64 (using go version go1.19 and LLVM version 14.0.0) and building to "wasi" target.

When I remove the import above and the "proto" usage, the filter loads successfully. Is there anything I am missing? Not sure why this is happening. Thanks

Ohad
  • 183
  • 3
  • 12

0 Answers0