cloudflare / cloudflare/workers-rs

🐛 BUG:Can't call javascript from a WASM worker

Open
#240 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
3.7k
Forks
429
Avg merge
20h 28m
Merged PRs (30d)
7

Description

### What version of `Wrangler` are you using?

2.1.13

### What operating system are you using?

Linux

### Describe the Bug

I can't call a JS function from my WASM worker, no matter how I call it. Here's an example function:

```
#[wasm_bindgen(inline_js = "export function blah() { console.log('blah'); }")]
extern "C" {
fn blah();
}
```

The error I get is the following:

```
✘ [ERROR] A request to the Cloudflare API (/accounts/xxxxxxxxxxxxxxxxxxxxxxxxxxxxx/workers/scripts/pijul) failed.

Uncaught TypeError: WebAssembly.Instance(): Import cloudflare/wrangler2#10
module="./snippets/blah-xxxxxxxxxxxxxx/inline0.js" error: module is not an object or function
at shim.js:13:9
[code: 10021]
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.