Databricks SQL Driver for Node.js - Error: TypeError: args.at is not a function

74 views Asked by At

I am trying to connect to a Databricks using Databricks SQL Driver for Node.js. I followed the instructions as mentioned here https://docs.databricks.com/en/dev-tools/nodejs-sql-driver.html#fetchall-method&language-TypeScript. I am using "Databricks personal access token authentication" method to connect to databricks. I am having latest version of sql driver installed in my package.json - "@databricks/sql": "^1.6.1", also I am having node version > 14 i.e v14.21.3 .

This is my code

try {
        const client: DBSQLClient = new DBSQLClient();
        console.log("created DBSQLClient");
        
        const connectOptions = {
            token: '***',
            host:  '***.cloud.databricks.com',
            path:  '/sql/1.0/warehouses/{***}'
        };
        const connection = await client.connect(connectOptions);
        console.log('Successfully connected to Databricks');

        const session: IDBSQLSession = await connection.openSession();
        const query = "Select 1";

        console.log("session created..");

        const queryOperation: IOperation = await session.executeStatement(
         query,
         {
          runAsync: true,
          maxRows: 10
         }
        );
        
        console.log("creating queryOperation..");

        const result = await queryOperation.fetchAll();
        console.log("Fetched result..");

        await queryOperation.close();
        await session.close();
        await connection.close();
} catch (error) {
  console.error("Error message:", error);
}

I am getting below error - Error: TypeError: args.at is not a function

Full logs:

created DBSQLClient
Successfully connected to Databricks
session created..
creating queryOperation..
Error: TypeError: args.at is not a function

does anyone have any insights on what may be causing this issue

0

There are 0 answers