libsql icon indicating copy to clipboard operation
libsql copied to clipboard

Embedded replica sync doesn't work

Open AvantaR opened this issue 1 year ago • 2 comments

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

AvantaR avatar Jan 02 '25 07:01 AvantaR