Consuming input failed: SSL connection has been closed unexpectedly

Hi all,

I have the below function that essentially sends 4 strings to a stored procedure.

def process_xml_data(xml_content: str, table_name: str, data_elements: list, element_name: str):
    try:
        conn = psycopg.connect(**connection_params)
        cur = conn.cursor()

        cur.execute("SELECT 1")
        if cur.fetchone()[0] == 1:
            print("Database connection is active.")

        proc_call = "CALL xml_to_sql(%s, %s, %s, %s)"
        print(f"attempting xml_to_sql on {table_name}")
        cur.execute(proc_call, (xml_content, table_name, data_elements, element_name))

        conn.commit()

        return "XML data sent to db"

    except psycopg.Error as e:
        print("Database error: ", e)

    finally:
        if cur:
            cur.close()
        if conn:
            conn.close()

There are 7 files I send and always on the largest file I get this issue consuming input failed: SSL connection has been closed unexpectedly

Am I doing something wrong? It takes about 2 seconds for the error to return and I’m ensuring the connection is open first.

Thanks in advance