tursodatabase / tursodatabase/libsql-client-ts

UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate

Open
#239 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
576
Forks
69
PR merge metrics
No merged PRs in 30d

Description

I'm running LibSQL server locally and using this sdk to connect to it. The following is my code:

import { createClient } from "@libsql/client"

const client = createClient({
  url: "libsql://localhost:8080",
  authToken: "",
})

const start = Bun.nanoseconds()

const queries = 1000
for (let i = 0; i < queries; i++) {
  await client.execute(
    "SELECT * FROM users;",
  );
}

const delta = (Bun.nanoseconds() - start) / 1000000;

console.log("Total time:", delta, "ms")
console.log("Avg time:", delta / queries, "ms")

I have spun up a docker container running the libsql-server, and when I use Postman to send queries it works perfectly fine, but when I run the above code; it throws the following error:

There has been an error while retrieving the database type.
Debug information:
- URL: https://localhost:8080
- Response Status Code: N/A
UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate
 path: "https://localhost:8080/v1/jobs"
UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate
 path: "https://localhost:8080/v2/pipeline"

Bun v1.1.18 (Linux x64)

I'm also not sure why it says the provided url is https://... when it's actually libsql://...?!

Any idea what I'm doing wrong?

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 createClient call against the Docker-hosted libSQL server using the shown libsql://localhost:8080 URL and query loop. Trace how the URL becomes https://localhost:8080 and how TLS certificates are handled for /v1/jobs and /v2/pipeline; done means the local connection succeeds or the required certificate and URL configuration is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, docker, sqlite, typescript
Domain
api, backend, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.