First of all, I am new to these kind of things, so this is probably a noob question.
I am following the 8-part Cassandra course on YouTube and in the third video (link to video), they go over connecting with Cassandra with a driver, for example on Gitpod. I believe that since then, some things have changed with the params for making connections (clientId and client secret). So instead of the "db_connection.js" used in the video, I added an "connect-database.js" as suggested on the tab Connect > Connect using a driver > Node.js on Astra and changed the references from db_connection.js to connect-database.js.
When I run
node connect-database.js
I get the response "Hello from cluster: cndb", which looks to me like I managed to get a connection.
Then, when I follow along the tutorial and go to exercise 2 in "Ex02_Connect_to_Cassandra.js". In the first line I changed "db_connection.js " > "connect-database.js ":
const connection = require('./connect-database'); const Uuid = require('cassandra-driver').types.Uuid; console.log("========================================") console.log("Start exercise") connection.client .execute('SELECT * FROM system.local') .then(function(result) { result.rows.forEach(row => { console.log("Your are now connected to cluster '%s'", row.cluster_name) }) connection.client.shutdown() console.log("SUCCESS") }) .catch(function(error){ console.log(error.message) connection.client.shutdown() }); console.log("========================================")
and I run:
node Ex02_Connect_to_Cassandra.js
I get the response "TypeError: Cannot read properties of undefined (reading 'execute') at Object.<anonymous> (/workspace/cassandra-workshop-series/week3-AppDev-crud/crud-nodejs/Ex02_Connect_to_Cassandra.js:8:2)". Which suggests to me that something is going wrong at the "execute" half way, but I can't figure out how to solve this.