diff --git a/src/common/helper.js b/src/common/helper.js index abc6e14..5546cc3 100644 --- a/src/common/helper.js +++ b/src/common/helper.js @@ -44,7 +44,7 @@ const awsConfig = { } if (config.AMAZON.AWS_ACCESS_KEY_ID && config.AMAZON.AWS_SECRET_ACCESS_KEY) { awsConfig.accessKeyId = config.AMAZON.AWS_ACCESS_KEY_ID - awsConfig.secretAccessKey = config.AMAZON.AWS_SECRET_ACCESS_KEY + awsConfig.secretAccessKey = config.AMAZON.AWS_SECRET_ACCESS_KEY } AWS.config.update(awsConfig) @@ -669,9 +669,13 @@ async function parseGroupIds (groupIds) { newIdArray.push(id) } else { try { - const { oldId } = await getGroupId(id) + logger.info(`parseGroupIds: fetch old id from uuid ${id}`) + const { oldId } = await getGroupId(id) if (oldId != null && oldId.trim() != '') { newIdArray.push(oldId) + logger.info(`parseGroupIds: old id found ${oldId}`) + } else { + logger.info(`parseGroupIds: old id not found for uuid ${id}`) } } catch (err) { } } @@ -682,13 +686,14 @@ async function parseGroupIds (groupIds) { async function getGroupId (id) { const token = await getM2MToken() return new Promise(function (resolve, reject) { - logger.info(`calling grouops API ${config.GROUPS_API_URL}/${id}`) + logger.info(`calling groups API ${config.GROUPS_API_URL}/${id}`) request({ url: `${config.GROUPS_API_URL}/${id}`, headers: { Authorization: `Bearer ${token}` } }, function (error, response, body) { if (response.statusCode === 200) { + logger.info(`response from groups API ${response.body}`) resolve(JSON.parse(body)) } else { logger.error(error) diff --git a/src/services/StatisticsService.js b/src/services/StatisticsService.js index 498d2cc..9a5c2e9 100644 --- a/src/services/StatisticsService.js +++ b/src/services/StatisticsService.js @@ -192,6 +192,7 @@ async function getMemberStats (currentUser, handle, query, throwError) { let stat try { // get statistics private by member user id from Elasticsearch + logger.info(`getMemberStats: fetching stats for group ${groupId}`) stat = await esClient.get({ index: config.ES.MEMBER_STATS_ES_INDEX, type: config.ES.MEMBER_STATS_ES_TYPE, @@ -199,8 +200,10 @@ async function getMemberStats (currentUser, handle, query, throwError) { }) if (stat.hasOwnProperty('_source')) { stat = stat._source + logger.info(`getMemberStats: stats found for groupId ${groupId}`) } } catch (error) { + logger.info(`getMemberStats: failed to get stats from es for groupId ${groupId}`) if (error.displayName === 'NotFound') { if (groupId === '10') { // get statistics by member user id from dynamodb @@ -212,6 +215,7 @@ async function getMemberStats (currentUser, handle, query, throwError) { } else { // get statistics private by member user id from dynamodb stat = await helper.getEntityByHashRangeKey(handle, 'MemberStatsPrivate', 'userId', member.userId, 'groupId', groupId, false) + logger.info(`getMemberStats: retrieved ${JSON.stringify(stat)} for groupId ${groupId}.`) } } }