libsql-client-ts icon indicating copy to clipboard operation
libsql-client-ts copied to clipboard

UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate

Open abdurahmanshiine opened this issue 1 year ago • 2 comments

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?

abdurahmanshiine avatar Jul 14 '24 10:07 abdurahmanshiine