question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Please fixe content-type for .wasm (WebAssembly)

See original GitHub issue

I’m submitting a…

[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  <!-- Please search GitHub for a similar issue or PR before submitting -->
[x] Feature request
[ ] Documentation issue or request
[ ] Other: <!-- Please describe: -->

Current behavior

I’m compiling WebAssembly (*.wasm) files and can’t serve these properly to the browser. Any “.wasm”-file is of content-type: “application/octet-stream”

Expected behavior

The proper content-type should be “application/wasm”

Environment

Browser:

- [ ] Chrome (desktop) version XX
- [x] Firefox version 62.0.2
- [ ] Safari (desktop) version XX
- [ ] IE version XX
- [ ] Edge version XX

For Tooling issues:

- Live Server: 5.1.1
- Platform:  Windows, compiling in WSL-ubuntu
- Visual Studio Code: 1.27.2

Others

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:50
  • Comments:9

github_iconTop GitHub Comments

5reactions
niilzcommented, Jun 25, 2020

I also still have this problem. Here is a quick work around though, if you need it:

I only have the MIME-type issue, when I try to load my wasm-module via the WebAssembly.instantiateStreaming(fetch('path/to/my_module.wasm')) -API. With the slightly more verbose an less efficient API: WebAssembly.instantiate(bytes) the import works completely fine.

Both in comparison:

// Desired API-usage (Currently apparently not working with Live-Server plugin)
async function getModuleFunctions() {
    const resultObject = await WebAssembly.instantiateStreaming(fetch('path/to/my_module.wasm'));
    return resultObj.instance.exports;
}

// Older API as work-around
async function getModuleFunctions() {
    const fetchResult = await fetch('path/to/my_module.wasm');
    const bytes = await fetchResult.arrayBuffer();
    const resultObj = await WebAssembly.instantiate(bytes);
    // The functions reside in the exports section on the resultObject.instance
    return resultObj.instance.exports;
}
2reactions
ThaUnknowncommented, Feb 22, 2021

how is this still not fixed…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python3 — Content-Type Application/WASM — How to fix.
Getting started is only a few clicks away from running Web assembly in your Chrome browser. Here are some tips and tricks to...
Read more >
Incorrect response MIME type. Expected 'application/wasm'.
I am piddling around with Electron and a web assembly C# SPA framework called Blazor that I'm wanting to try and get working...
Read more >
aws amplify not serving content-type for wasm - Stack Overflow
I've written a wasm module with wasm-pack in rust. I'm using it as part of a react SPA. I've published the wasm library...
Read more >
Warning about "Content-Type" being configured incorrectly
"HTTP Response Header "Content-Type" configured incorrectly on the ... Once everything was setup correctly on the server, it fixed itself ...
Read more >
Optimizing WebAssembly Startup Time - PSPDFKit
This can be done using the WebAssembly.compile() function, which takes a typed array or ArrayBuffer containing the binary code of the .wasm module...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found