All Authentication Methods Failed Error When Using ssh2 With Custom Database Functions

I am trying to connect to my Postgres database with the custom database functions. Im using AWS, and connecting to the database through an ssh tunnel. The tunnel goes to my ec2 instance. I was able to get the tunnel and everything working on a local node runtime without any issues. However, when trying it with the “save & try” button on the custom database code editor, I get an “SSH failed: All configured authentication methods failed” error.

function login(identifierValue, password, callback) {
    //this example uses the "pg" library
    //more info here: https://github.com/brianc/node-postgres
    const { Client } = require('ssh2');
    const conn = new Client();

    conn.on('ready', () => {
      return callback(null, { user_id: 'ssh_test', nickname: 'success', email: 'test@example.com' });
    }).on('error', (err) => {
      return callback(new Error('SSH failed: ' + err.message));
    }).connect({
      host:configuration.EC2_SSH_HOST,
      port: 22,
      username: configuration.EC2_SSH_USER,
      privateKey: Buffer.from(configuration.EC2_SSH_PKEY, 'base64'),
      debug: console.log
    });

}

I have already verified that my key works and is valid many times. I’ve also checked that the base64 is encoding correctly. Furthermore, I know its not a connection issue, or else I wouldn’t be getting that authentication methods error. My best guess is that something on the Auth0 end is causing problems.