Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate #239

Open
abdurahmanshiine opened this issue Jul 14, 2024 · 2 comments
Open

Comments

@abdurahmanshiine
Copy link

abdurahmanshiine commented Jul 14, 2024

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
Copy link
Author

Any comments on this 😕

@JayJamieson
Copy link

JayJamieson commented Jul 30, 2024

@abdurahmanshiine Doesn't look to be a Bun specific issue.

I get a somewhat similar issue running under node v20. If it's blocking you from working locally you could try "http://localhost:8080" instead of "libsql://localhost:8080". This seems to get around the initial error.

Edit: Ah right, libsql:// URLs use TLS by default. Update your config as such to disable TLS or use the above suggested http:// scheme.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants