Skip to content

WASM cache adapter: binding undefined causes Wrong API use error #334

@dergigi

Description

@dergigi

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

  1. Configure NDK with new NDKCacheAdapterSqliteWasm({ name: 'ants-cache', size: 64 }).
  2. Issue a search query containing an author clause such as free by:ross via searchEvents().
  3. 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions