Passthrough changes Response to be not compliant with WebAssembly.instantiateStreaming
See original GitHub issueFirst of all, we are using Mirage with an Ember project and it works fine šthanks for the awesome work. Since we really like Mirage we also tried to get it running for a Vue project which was scaffolded with vue-cli
.
Currently, we are struggling to get Cypress running. We use the following plugin @vue/cli-plugin-e2e-cypress
. I tried several things but Iām just not able to get our WebAssembly module running.
We start our WebAssembly module with WebAssembly.instantiateStreaming
and also if I passthrough the wasm file Chrome complains the following way:
Mirage: Passthrough request for GET /static/artifacts/wasm/kernel.wasm
TypeError: Failed to execute 'compile' on 'WebAssembly': An argument must be provided, which must be a Response or Promise<Response> object
After some investigation, I think that Mirage wraps every Response in its own Response class? Is this true? For some reason, I wasnāt able to figure out why the type-check on instantiateStreaming
fails. When searching the internet for this error message I only found the following source code: https://doss-gitlab.eidos.ic.i.u-tokyo.ac.jp/kevin/chromium/blob/ad3841a1e47cd90bba10f271a8495d4040490b07/third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.cc#L283
Iām a little bit lost (also because debugging is super hard with the vue-cli
setup since Cypress is running somewhere else etc).
Any ideas what I could try to get the WebAssembly module running? Basically I followed those two quickstarters:
Let me know if you need further info
Issue Analytics
- State:
- Created 4 years ago
- Comments:20 (6 by maintainers)
Top GitHub Comments
I found a workaround which works at least for us, what I do now is the following:
@samselikoff maybe you could have a look at this workaround and let me know if this is OK or if itās a stupid idea to do it like this š thanks a lot
@ryanto thanks for the response and sorry for the late reply but yesterday was a national public holiday in Austria. I created a repo which demonstrates the issue: https://github.com/miragejs/miragejs/issues/339#issuecomment-596625395
Let me know if this is enough our if you need further information š
I think itās a bug š in FakeXMLHttpRequest because I think FakeXMLHttpRequest does not set the
responseType
correctly. When debugging I found no sane way to tell FakeXMLHttpRequest to set the responseType. The only way I found was to set the rsponseType based on the file extension. This is what I outlined above in thepassthrough
hack