Bug report
Describe the bug
When i use @supabase/sql-to-rest in my React + Vite project. It show this error in the browser.
@supabase_sql-to-rest.js?v=60f33d70:1653 wasm streaming compile failed: TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.
RuntimeError: Aborted(CompileError: WebAssembly.instantiate(): expected magic word 00 61 73 6d, found 3c 21 64 6f @+0). Build with -sASSERTIONS for more info.
It may occurs since when getting libpg-query.wasm with Vite. It doesn't have a response-header Content-Type: application/wasm
To Reproduce
- Use this code in the project (My project is React + Vite)
import { processSql } from '@supabase/sql-to-rest';
<Button
onClick={async () => {
const fullSqlString = 'SELECT * FROM dummy';
const statement = await processSql(fullSqlString);
console.log('🚀 ~ statement:', statement);
}}
>
Test
</Button>
Expected behavior
No error being throwed as in the document, i see that it Works on both browser and server. I've used this package in my NestJs project and it's fine. Or is there any way that i can solve this problem with Vite?
Screenshots
System information
- OS: macOS
- Browser: Chrome
- Version of "@supabase/supabase-js": "^2.43.4",
- Version of "@supabase/sql-to-rest": "^0.1.6",
Bug report
Describe the bug
When i use @supabase/sql-to-rest in my React + Vite project. It show this error in the browser.
@supabase_sql-to-rest.js?v=60f33d70:1653 wasm streaming compile failed: TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.RuntimeError: Aborted(CompileError: WebAssembly.instantiate(): expected magic word 00 61 73 6d, found 3c 21 64 6f @+0). Build with -sASSERTIONS for more info.It may occurs since when getting
libpg-query.wasmwith Vite. It doesn't have a response-headerContent-Type: application/wasmTo Reproduce
Expected behavior
No error being throwed as in the document, i see that it Works on both browser and server. I've used this package in my NestJs project and it's fine. Or is there any way that i can solve this problem with Vite?
Screenshots
System information