Issues with SSHTunnelForwarder when deploying app

Hi! I’m trying to deploy an app that connects to a MySQL database through an SSH Tunnel. I’m currently getting this error when deploying:

  File "/home/appuser/venv/lib/python3.9/site-packages/sshtunnel.py", line 966, in __init__

    (self.ssh_password, self.ssh_pkeys) = self._consolidate_auth(

  File "/home/appuser/venv/lib/python3.9/site-packages/sshtunnel.py", line 1169, in _consolidate_auth

    raise ValueError('No password or public key available!')

ValueError: No password or public key available!

I have a block of code for the whole SQL-SSH connection that looks like this:

import MySQLdb as db
from sshtunnel import SSHTunnelForwarder

def query(q):

    with SSHTunnelForwarder(                                                  
          ssh_address_or_host=("host_ip"),                         
          ssh_username=("host_username"),                                      
          ssh_pkey=("path_to_private_sshkey"),                                           
          remote_bind_address=("private_host_ip", "host_port")       
     ) as server:
          
          conn = db.connect(host="localhost",                          
          port=server.local_bind_port,                                          
          user=("db_username"),                                              
          passwd=("db_password"),                                        
          db=("db_database")                                           

          return pd.read_sql_query(q, conn)

I hope you can help me out!