Summary
When using NDKCacheAdapterSqliteWasm inside our Next.js app, queries that include author filters (e.g. free by:ross) intermittently crash with the following runtime error:
Wrong API use : tried to bind a value of an unknown type (undefined).
Environment
@nostr-dev-kit/ndk-cache-sqlite-wasm 0.5.8
@nostr-dev-kit/ndk 2.14.33
- Next.js 15.4.6 (React 19)
- Running in dev mode (
next dev)
Reproduction
- Configure NDK with
new NDKCacheAdapterSqliteWasm({ name: 'ants-cache', size: 64 }).
- Issue a search query containing an author clause such as
free by:ross via searchEvents().
- The sqlite worker throws the error above (originating from
setParameter inside worker.b59ef1cc.js).
The same query works fine when switching back to the Dexie cache adapter. Looks like the WASM cache attempts to bind an undefined parameter instead of a string/number.
Could you add a guard (or coerce to empty string) before binding, or otherwise handle undefined values gracefully?
Thanks!
Summary
When using
NDKCacheAdapterSqliteWasminside our Next.js app, queries that include author filters (e.g.free by:ross) intermittently crash with the following runtime error:Environment
@nostr-dev-kit/ndk-cache-sqlite-wasm0.5.8@nostr-dev-kit/ndk2.14.33next dev)Reproduction
new NDKCacheAdapterSqliteWasm({ name: 'ants-cache', size: 64 }).free by:rossviasearchEvents().setParameterinsideworker.b59ef1cc.js).The same query works fine when switching back to the Dexie cache adapter. Looks like the WASM cache attempts to bind an
undefinedparameter instead of a string/number.Could you add a guard (or coerce to empty string) before binding, or otherwise handle undefined values gracefully?
Thanks!