Skip to content

[Drift] JS SDK v2 refactors database open options, removes flags field, and changes default connection method (powersync-js #987) #510

@benitav

Description

@benitav

What's changing: The JavaScript SDK v2 pre-release refactors database open and sync option types: factory objects previously passed via the database constructor key must now use a factory key; the flags constructor field and WebSQLFlags type are removed (options redistributed across database, broadcastLogs, and other top-level keys); WASQLiteOpenFactory takes a restructured options object; and the default sync connection method changes from WebSocket to HTTP.

High priority — existing docs are now inaccurate or incomplete

  • JavaScript Web SDK Reference (https://docs.powersync.com/client-sdks/reference/javascript-web) — The "SQLite Virtual File Systems" section contains three code examples (OPFSCoopSyncVFS, AccessHandlePoolVFS, OPFSWriteAheadVFS) using database: new WASQLiteOpenFactory({...}); in v2, a factory object must be passed via the factory key, not database. The OPFSCoopSyncVFS example additionally sets flags: { enableMultiTabs: ... } inside the WASQLiteOpenFactory constructor, which is also removed. The "Using PowerSyncDatabase Flags" section documents the flags: { enableMultiTabs, broadcastLogs, disableSSRWarning, ssrMode, useWebWorker } constructor option and the resolveWebPowerSyncFlags / WebPowerSyncFlags types — the flags field is removed in v2 and these options are distributed across other keys. The "Connection Methods" section states "1. WebSocket (Default)" and "By default, the PowerSyncDatabase.connect() method uses WebSocket" — in v2 the default changes to HTTP.

  • Next.js SDK (https://docs.powersync.com/client-sdks/frameworks/next-js) — The database initialization example uses database: new WASQLiteOpenFactory({...}) and flags: { disableSSRWarning: true } on the constructor. Both patterns are removed in v2.

  • Capacitor SDK Reference (https://docs.powersync.com/client-sdks/reference/capacitor) — The initialization example uses database: isWeb ? new WASQLiteOpenFactory({ dbFilename: "mydb.sqlite" }) : new CapacitorSQLiteOpenFactory(...). Passing a factory object as the database value is removed in v2.

  • Troubleshooting (https://docs.powersync.com/debugging/troubleshooting) — A VFS configuration snippet uses database: new WASQLiteOpenFactory({ dbFilename: 'exampleVFS.db', ... }), which is wrong for v2.

For reviewer consideration — may be worth documenting

  • client-sdks/frameworks/react-native-web-support.mdx — Verified to use WASQLiteOpenFactory in code examples; the exact constructor call pattern (database: factory vs. factory: factory) was not confirmed. If it passes the factory via the database key, it is also affected.
  • client-sdks/reference/react-native-and-expo.mdx — The "Connection Methods" section also states "WebSocket (Default)" and includes "Not needed when using websockets, which is the default since @powersync/react-native@1.11.0". Whether the React Native package inherits the connection method default change is unclear since @powersync/react-native is not in the PR changeset.

Source PR: powersync-ja/powersync-js#987 — merged to the v2 pre-release branch on 2026-06-12. This change has not shipped in a stable release.

Filed automatically by Claude Code (claude-sonnet-4-6). A human must verify the scope, prepare the docs PR, and publish it only once this update has been released.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions