tursodatabase / tursodatabase/libsql

Embedded replica sync doesn't work

Open
#1,900 2 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
17.2k
Forks
531
Avg merge
1h 12m
Merged PRs (30d)
1

Description

I try to use embedded replica synchronization with bun, but I got error like below:

bun db.sync.ts
2025-01-02T07:39:51.248873Z ERROR tower_http::trace::on_failure: response failed classification=Code: 12 latency=321 ms
2025-01-02T07:39:51.248961Z ERROR libsql_replication::replicator: error connecting to primary. retrying. error: status: Unimplemented, message: "embedded replicas are not supported for this platform and tariff plan", details: [], metadata: MetadataMap { headers: {"content-length": "0", "content-type": "application/grpc-web-text", "date": "Thu, 02 Jan 2025 07:39:51 GMT"} }
2025-01-02T07:39:52.306555Z ERROR tower_http::trace::on_failure: response failed classification=Code: 12 latency=55 ms
2025-01-02T07:39:53.364330Z ERROR tower_http::trace::on_failure: response failed classification=Code: 12 latency=56 ms
138 |             }
139 |         }
140 |     }
141 |     async sync() {
142 |         this.#checkNotClosed();
143 |         const rep = await this.#getDb().sync();
                                              ^
error: Replication(PrimaryHandshakeTimeout)

System: MacOS
Plan: Free
bun: 1.1.27
@libsql/client: 0.14.0

The code I'm running:

import { createClient } from '@libsql/client';

const client = createClient({
  url: 'file:replica.db',
  syncUrl: process.env.DATABASE_URL!,
  authToken: process.env.DATABASE_AUTH_TOKEN,
});

await client.sync();

The URL and auth token are valid, because it successfully connects to the DB at the edge.

I appreciate any help. Regards

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the supplied client.sync() example with Bun on macOS and @libsql/client 0.14.0, then trace the embedded-replica sync entry point and the returned platform and tariff-plan error. The payload names no repository files or tests; done means determining whether the failure is an implementation bug or an unsupported configuration and recording the result with a focused test or documentation change.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, javascript, sqlite
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.