File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -16,8 +16,12 @@ const isAwsKeyspaces = process.env.DB_IS_AWS_KEYSPACES
16
16
17
17
let client : Client ;
18
18
19
+ console . log ( isAwsKeyspaces )
20
+ console . log ( process . env . DB_CONTACT_POINTS , process . env . DB_LOCAL_DATACENTER , process . env . DB_KEYSPACE )
19
21
// Set up Cassandra connection configuration for local and AWS Keyspaces
20
22
if ( isAwsKeyspaces ) {
23
+ console . log ( "Aws athenticate way" )
24
+ console . log ( AWS . config . credentials )
21
25
// AWS Keyspaces connection setup
22
26
client = new Client ( {
23
27
contactPoints : [ process . env . DB_CONTACT_POINTS || 'cassandra.us-east-1.amazonaws.com' ] , // AWS Keyspaces endpoint
@@ -81,12 +85,13 @@ const ensureTable = async () => {
81
85
// Connect to Cassandra
82
86
export const connectToCassandra = async ( ) => {
83
87
try {
84
- // Ensure the keyspace and table exist before connecting
85
- await ensureKeyspace ( ) ;
86
- await ensureTable ( ) ;
87
-
88
+ // First, connect to the Cassandra cluster
88
89
await client . connect ( ) ;
89
90
console . log ( 'Connected to Cassandra' ) ;
91
+
92
+ // Ensure the keyspace and table exist after connecting
93
+ await ensureKeyspace ( ) ;
94
+ await ensureTable ( ) ;
90
95
} catch ( error ) {
91
96
console . error ( 'Cassandra connection error:' , error ) ;
92
97
throw error ;
You can’t perform that action at this time.
0 commit comments