electric-sql / pglite

Lightweight WASM Postgres with real-time, reactive bindings.
https://pglite.dev
Apache License 2.0
9.46k stars 204 forks source link

Uncaught RuntimeError: Aborted(CompileError: WebAssembly.instantiate(): expected magic word 00 61 73 6d, found 3c 21 64 6f @+0). Build with -sASSERTIONS for more info. #288

Closed sombriks closed 2 months ago

sombriks commented 2 months ago

i am getting this error when trying to use pglite on latest chrome linux in a vite project:

Uncaught RuntimeError: Aborted(CompileError: WebAssembly.instantiate(): expected magic word 00 61 73 6d, found 3c 21 64 6f @+0). Build with -sASSERTIONS for more info.

any guidance is welcome, here goes a repo sampling the error: https://github.com/sombriks/vue-pglite-knex-example

my environment:

Chrome: Versão 128.0.6613.113 (Versão oficial) 64 bits SO: Linux barbatos 6.10.6-200.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Aug 19 14:09:30 UTC 2024 x86_64 GNU/Linux

samwillis commented 2 months ago

Hey @sombriks

Vite requires some specific configuration to skip some packaging optimisations. Essentially it's returning the projects index.html for the request for the WASM binary.

Config docs are here: https://pglite.dev/docs/bundler-support#vite

This is the same issue as #199, we are going to improve this error message.

sombriks commented 2 months ago

@samwillis thank you so much, it's working like a charm!