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

Error "invalid peer certificate: UnknownIssuer" on Deno but not on Node #20362

Open
DMeechan opened this issue Sep 2, 2023 · 2 comments
Open

Comments

@DMeechan
Copy link

DMeechan commented Sep 2, 2023

I get this error when connecting to a Supabase Postgres database using Postgres.js on Deno 1.36.3+c9223bc:

import postgres from "https://deno.land/x/postgresjs@v3.3.5/mod.js"; // For Deno
// import postgres from "postgres"; // For Node

const sql = postgres(databaseUrl, { ssl: "require" });
await sql`SELECT 1`;


// Result:
error: Uncaught (in promise) InvalidData: invalid peer certificate: UnknownIssuer
        while ((result = socket.readyState === 'open' && await raw.read(b))) {
                                                         ^
    at async TlsConn.read (ext:deno_net/01_net.js:107:15)

However, the code above works fine on Node.js v18.17.1

@DMeechan
Copy link
Author

DMeechan commented Sep 2, 2023

I was able to solve this error by setting DENO_CERT=./certs/supabase.crt env variable

However, is the error intentional? Or do we expect the code above to pass, like on Node?

@kahirokunn
Copy link

I encountered the same error message when I tried to use a client certificate.

nodejs/node#48977

const { Agent } = require('undici');

fetch(url, {
    dispatcher: new Agent({
        connect: {
            cert: cert,
            key: key,
            ca: ca
        }
    })
});

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