1.3.4 and 1.3.3 failing in Cloudflare Worker env for different reasons
kmusick opened this issue · comments
I'm really in over my head on this one but here is my understanding.
Due to changes mentioned in #687, 1.3.4 does not work correctly in wasm32-unknown-unknown:
panicked at 'time not implemented on this platform', library/std/src/sys/wasm/../unsupported/time.rs:31:9
However, 1.3.3 also fails on Cloudflare Workers:
LinkError: WebAssembly.Instance(): Import #9 module="./index_bg.js" function="__wbg_now_5eac63e226f04e45" error: function import requires a callable
With the changes made in PR #688, all wasm32-unknown-unknown tests work fine. A very similar issue is brought up in this issue. Applying the same fix keeps all tests happy and allows v7_now() to be used in Cloudflare Workers. Here is the fix:
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = Date)]
fn now() -> f64;
}
let now = now();
becomes:
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = Date, catch)]
fn now() -> Result<f64, JsValue>;
}
let now = now().unwrap_throw();
Not sure how to test for this and I don't really understand what is causing the issue. However, the updated code works and passes all tests.