WebAssembly error: TypeError: Incorrect response MIME type. Expected 'application/wasm'.

1,687 views
Skip to first unread message

Nvrnight

unread,
Jun 25, 2018, 4:09:33 AM6/25/18
to Chromium-discuss
Hi Guys,

Sorry if this isn't the correct place to talk about this, I wasn't for sure if I should be talking about this here for over in electron somewhere. I am piddling around with Electron and a web assembly C# SPA framework called Blazor that I'm wanting to try and get working without having a web server back-end. I figured I would be able to just load all the client-side files from a folder just like with referencing local js files in a .html file using relative pathing and such.

The error I'm running across is "TypeError: Incorrect response MIME type. Expected 'application/wasm'." when trying to run this bit of code...
<script>
        WebAssembly.instantiateStreaming(fetch("relative/path/to/file.wasm", {
            credentials: "same-origin",
            headers: {
                "Content-Type": "application/wasm"
            }
        }), {}).then(output => {
            console.log(output);
        }).catch(reason => {
            console.log(reason);
        });
    </script>

The headers portion of the code is my own doing to attempt to get around the error, I figured I could just tell it what the Content-Type is rather than it expecting it from the response since it's getting it off the file system, but I guess it's just using it to verify the response headers?

I'm fairly ignorant about WebAssembly in general, looking for some possible advice on how to workaround the error.

PhistucK

unread,
Jun 25, 2018, 5:12:45 AM6/25/18
to nvrn...@gmail.com, Chromium-discuss
If you can reproduce the same in Chrome/Chromium, then this is indeed the place.
Looks like Chrome is checking the content type even in file:// URLs, which is probably wrong, but file:// is discouraged and have some quirks that HTTP does not have, so fixes are either low priority, or are intentionally not fixed because they can lead to security issues.

You can search crbug.com for an existing issue and star it. If you cannot find one, you can try and file a new issue using the "New issue" link on the same page.
Please, do not add a "+1" or "Me too" or "Confirmed" (or similar) comment. It just wastes the time of Chrome engineers and sends unnecessary e-mails to all of the people who starred the issue.

You can reply with a link to the found or created issue and might get triaged (and fixed) faster.

Thank you.


PhistucK


--
--
Chromium Discussion mailing list: chromium...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discu...@chromium.org.
Reply all
Reply to author
Forward
0 new messages