Skip to content

[BUG] Storage adapter interface doesn't expose a way to detect storage availability before use, so SSR environments throw at import time #789

Open

Description

@meshackyaro

Description

Importing the SDK in a server-side-rendering context (where window/localStorage don't exist) throws at module-evaluation time because the default storage adapter unconditionally references window.localStorage.

Component

storage

Steps to Reproduce

  1. Import the SDK's browser entrypoint in a Node.js SSR context (e.g. a Next.js getServerSideProps function).
  2. Observe the thrown error.
  3. Compare against expected graceful behavior for SSR contexts.

Expected Behavior

The default storage adapter should lazily check for window/localStorage availability and fall back to a no-op/in-memory adapter in SSR contexts, rather than throwing at import time.

Actual Behavior

The SDK is unusable in any SSR-rendered path without the consumer manually guarding every import, which is a common and painful gotcha for Next.js/Remix integrators.

Environment

  • SDK version: 0.3.x
  • Node version: 20.x, 22.x
  • OS: macOS / Linux
  • Network: TESTNET

Code Example

// Not applicable — reproduced via API inspection, not a standalone snippet.

Error Output

ReferenceError: window is not defined

Difficulty

🟡 Medium

Additional Context

The default storage adapter references window.localStorage at module scope rather than lazily inside each method.

Activity

  1. added
    bug
    good first issue
    priority: high
    difficulty: medium
    on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdifficulty: mediumgood first issueinfrastructurepriority: highsdk

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions