6

I'm using deno db to connect to a supabase postgres server.

Here's the error from deno deploy.

TLS connection failed with message: invalid peer certificate contents: invalid peer certificate: UnsupportedCertVersion Defaulting to non-encrypted connection

enter image description here

Establishing connection here:

import { Database, PostgresConnector } from "https://deno.land/x/denodb/mod.ts";
import "https://deno.land/x/dotenv/load.ts";

export const connection = (() => {
  const DENODB_PGURL = Deno.env.get('DENODB_PGURL');

  if (DENODB_PGURL) {
    return new PostgresConnector({uri: DENODB_PGURL});  
  }

  const DENODB_HOST = Deno.env.get('DENODB_HOST');
  if (!DENODB_HOST) throw new Error('DENODB_HOST is not set');
  const DENODB_USERNAME = Deno.env.get('DENODB_USERNAME');
  if (!DENODB_USERNAME) throw new Error('DENODB_USERNAME is not set');
  const DENODB_PASSWORD = Deno.env.get('DENODB_HOST');
  if (!DENODB_PASSWORD) throw new Error('DENODB_PASSWORD is not set');
  const DENODB_DATABASE = Deno.env.get('DENODB_DATABASE');
  if (!DENODB_DATABASE) throw new Error('DENODB_DATABASE is not set');
  
  return new PostgresConnector({
    host: DENODB_HOST,
    username: DENODB_USERNAME,
    password: DENODB_PASSWORD,
    database: DENODB_DATABASE,
  });

})()

const db = new Database(connection);

export default db;

I'm issuing a .create call later in the code.

To be clear the connection works and records are being created đź’Ż

5
  • That looks like the error from the client side. Look in the db server's log fie to see how it experiences this error. Also, what version of the database is this?
    – jjanes
    Aug 26, 2022 at 13:10
  • 1
    Maybe you have already tried this, but have you tried updating your Supabase CLI to the most recent version?
    – dshukertjr
    Aug 31, 2022 at 6:43
  • 2
    @dshukertjr this is happening on deno deploy not using the subpabase cli :) Aug 31, 2022 at 12:28
  • Not sure, but might be related to this Deno issue: github.com/denoland/deno/issues/13350
    – thorwebdev
    Sep 26, 2022 at 7:56
  • Can you share an minimal reproducible example of a function that is failing?
    – Mansueli
    Apr 24, 2023 at 13:10

1 Answer 1

0

through this doc: https://deno.com/blog/v1.13

you can try deno run --unsafely-ignore-certificate-errors ...

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.