Closed as not planned
Closed as not planned
Description
Hello, I'm trying to use the ring's SHA and HMAC for wasm32-unknown-unknown
target. I'm building the WASM plugin for the envoy proxy. The build procedure works, but I can't load the WASM file into envoy's. Here is the reproducible source:
Cargo.toml:
[package]
name = "rust_wasm_test"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["cdylib"]
[dependencies]
log = "0.4.14"
proxy-wasm = "0.1.4"
ring = "0.16.20"
src/lib.rs:
use proxy_wasm as wasm;
use ring;
#[no_mangle]
pub fn _start() {
proxy_wasm::set_log_level(wasm::types::LogLevel::Trace);
proxy_wasm::set_http_context(
|_context_id, _root_context_id| -> Box<dyn wasm::traits::HttpContext> {
Box::new(HelloWorld { })
},
)
}
struct HelloWorld {}
impl wasm::traits::Context for HelloWorld {}
impl wasm::traits::HttpContext for HelloWorld {}
Example configuration for envoy:
static_resources:
listeners:
- name: main
address:
socket_address:
address: 0.0.0.0
port_value: 18000
filter_chains:
- filters:
- name: envoy.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
stat_prefix: ingress_http
codec_type: auto
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains:
- "*"
routes:
- match:
prefix: "/"
direct_response:
status: 200
body:
inline_string: "example body\n"
http_filters:
- name: envoy.filters.http.wasm
typed_config:
"@type": type.googleapis.com/udpa.type.v1.TypedStruct
type_url: type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm
value:
config:
vm_config:
runtime: "envoy.wasm.runtime.v8"
code:
local:
filename: ".//target/wasm32-unknown-unknown/debug/rust_wasm_test.wasm"
- name: envoy.filters.http.router
admin:
access_log_path: "/dev/null"
address:
socket_address:
address: 0.0.0.0
port_value: 8001
After building via cargo build --target=wasm32-unknown-unknown
and running envoy via envoy --config-path envoy.yaml --concurrency 0 -l info
I'm getting this error from the envoy side:
[2022-02-02 12:24:28.468][3533850][error][wasm] [source/extensions/common/wasm/wasm_vm.cc:38] Failed to load Wasm module due to a missing import: __wbindgen_externref_xform__.__wbindgen_externref_table_grow
[2022-02-02 12:24:28.468][3533850][error][wasm] [source/extensions/common/wasm/wasm_vm.cc:38] Failed to load Wasm module due to a missing import: __wbindgen_placeholder__.__wbindgen_describe
[2022-02-02 12:24:28.468][3533850][error][wasm] [source/extensions/common/wasm/wasm_vm.cc:38] Failed to load Wasm module due to a missing import: __wbindgen_externref_xform__.__wbindgen_externref_table_set_null
[2022-02-02 12:24:28.468][3533850][error][wasm] [source/extensions/common/wasm/wasm_vm.cc:38] Failed to load Wasm module due to a missing import: __wbindgen_placeholder__.__wbindgen_throw
[2022-02-02 12:24:28.468][3533850][error][wasm] [source/extensions/common/wasm/wasm.cc:109] Wasm VM failed Failed to initialize Wasm code
[2022-02-02 12:24:28.472][3533850][critical][wasm] [source/extensions/common/wasm/wasm.cc:471] Plugin configured to fail closed failed to load
[2022-02-02 12:24:28.481][3533850][critical][main] [source/server/server.cc:117] error initializing configuration 'envoy.yaml': Unable to create Wasm HTTP filter
There are a lot of libraries that depend on the ring, however, I can't use them because of the broken dependency...
Metadata
Metadata
Assignees
Labels
No labels