Skip to content

Missing Web Assembly module in NextJS Server Environment #138

@Cruzor-Blade

Description

@Cruzor-Blade

Hello, and thanks for this awesome package !
So, I have been trying to use the libpg-query package inside a nextjs server environment to parse and validate some SQL queries, but I am getting the output

(Using Webpack)

pnpm run dev

failed to asynchronously prepare wasm: Error: ENOENT: no such file or directory, open 'C:\Petit p\densograph_2\citygraph\.next\server\vendor-chunks\libpg-query.wasm'
Aborted(Error: ENOENT: no such file or directory, open 'C:\Petit p\densograph_2\citygraph\.next\server\vendor-chunks\libpg-query.wasm')
 GET /api/chat 405 in 3901ms
[RuntimeError: Aborted(Error: ENOENT: no such file or directory, open 'C:\Petit p\densograph_2\citygraph\.next\server\vendor-chunks\libpg-query.wasm'). Build with -sASSERTIONS for more info.]
 ⨯ unhandledRejection: [RuntimeError: Aborted(Error: ENOENT: no such file or directory, open 'C:\Petit p\densograph_2\citygraph\.next\server\vendor-chunks\libpg-query.wasm'). Build with -sASSERTIONS for more info.]    
 ⨯ unhandledRejection:  [RuntimeError: Aborted(Error: ENOENT: no such file or directory, open 'C:\Petit p\densograph_2\citygraph\.next\server\vendor-chunks\libpg-query.wasm'). Build with -sASSERTIONS for more info.]   
 ○ Compiling /_not-found ...

So, I checked and it appears that the web assembly module is not being included in the build at .next\server\vendor-chunks\libpg-query.wasm.

Edit with additional informations
Running it with npm instead of pnpm, and using Turbopack instead of Webpack gives a distinct (but similar) error
(Using Turpopack)

npm run dev

failed to asynchronously prepare wasm: Error: ENOENT: no such file or directory, open 'C:\Petit p\densograph_2\citygraph\[project]\node_modules\libpg-query\wasm\libpg-query.js [app-route] (ecmascript)\libpg-query.wasm'
Aborted(Error: ENOENT: no such file or directory, open 'C:\Petit p\densograph_2\citygraph\[project]\node_modules\libpg-query\wasm\libpg-query.js [app-route] (ecmascript)\libpg-query.wasm')
 GET /api/chat 405 in 2326ms
[RuntimeError: Aborted(Error: ENOENT: no such file or directory, open 'C:\Petit p\densograph_2\citygraph\[project]\node_modules\libpg-query\wasm\libpg-query.js [app-route] (ecmascript)\libpg-query.wasm'). Build with -sASSERTIONS for more info.]
 ⨯ unhandledRejection: [RuntimeError: Aborted(Error: ENOENT: no such file or directory, open 'C:\Petit p\densograph_2\citygraph\[project]\node_modules\libpg-query\wasm\libpg-query.js [app-route] (ecmascript)\libpg-query.wasm'). Build with -sASSERTIONS for more info.]
 ⨯ unhandledRejection:  [RuntimeError: Aborted(Error: ENOENT: no such file or directory, open 'C:\Petit p\densograph_2\citygraph\[project]\node_modules\libpg-query\wasm\libpg-query.js [app-route] (ecmascript)\libpg-query.wasm'). Build with -sASSERTIONS for more info.]

My development environment is Windows, and Node 20

Hoping this problem can be solved pretty soon. Thanks in advance !

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions