From 065f4b1aa9cc75c71f0199eaff4f368699a9e65e Mon Sep 17 00:00:00 2001 From: Joshua Tahanlangit Date: Tue, 1 Aug 2023 22:41:41 +0800 Subject: [PATCH 1/2] Update CyclicSessionStore.js https://github.com/cyclic-software/session-store/issues/8 --- src/CyclicSessionStore.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/CyclicSessionStore.js b/src/CyclicSessionStore.js index afd9844..5dccb33 100644 --- a/src/CyclicSessionStore.js +++ b/src/CyclicSessionStore.js @@ -75,7 +75,9 @@ class CyclicSessionStore extends Store { this.attributeDefinitions.push({ AttributeName: this.sortKey, AttributeType: 'S' }) } - console.error(this) + if (process.env.DYNAMODB_STORE_DEBUG) { + console.error(this) + } } @@ -105,10 +107,6 @@ class CyclicSessionStore extends Store { this.documentClient.send(new PutCommand(params)).then(callback) } catch (err) { - - console.error('sadfsadfasdf') - console.error(err) - debug('Error saving session', { sid, sess, @@ -134,7 +132,9 @@ class CyclicSessionStore extends Store { }, ConsistentRead: true } - console.log(params) + if (process.env.DYNAMODB_STORE_DEBUG) { + console.log(params) + } const { Item: record } = await this.documentClient.send(new GetCommand(params)) From ac944f6259a92346fe9883c9066c79c31afe01d0 Mon Sep 17 00:00:00 2001 From: Joshua Tahanlangit Date: Tue, 1 Aug 2023 23:17:05 +0800 Subject: [PATCH 2/2] Update CyclicSessionStore.js Replace console messages with the debug util --- src/CyclicSessionStore.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/CyclicSessionStore.js b/src/CyclicSessionStore.js index 5dccb33..7faadbf 100644 --- a/src/CyclicSessionStore.js +++ b/src/CyclicSessionStore.js @@ -75,9 +75,7 @@ class CyclicSessionStore extends Store { this.attributeDefinitions.push({ AttributeName: this.sortKey, AttributeType: 'S' }) } - if (process.env.DYNAMODB_STORE_DEBUG) { - console.error(this) - } + debug('optionsToInstance dump', this); } @@ -132,9 +130,7 @@ class CyclicSessionStore extends Store { }, ConsistentRead: true } - if (process.env.DYNAMODB_STORE_DEBUG) { - console.log(params) - } + debug('dynamodb session params', params); const { Item: record } = await this.documentClient.send(new GetCommand(params))