diff --git a/package.json b/package.json index 30cbedba..397ba89c 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "sls-undeploy": "node --require ./dotenv.js ./node_modules/serverless/bin/serverless remove", "sls-logs-hook": "node --require ./dotenv.js ./node_modules/serverless/bin/serverless logs -f gtmGithubHook -t", "sls-logs-results": "node --require ./dotenv.js ./node_modules/serverless/bin/serverless logs -f gtmGithubResults -t", + "sls-logs-metrics": "node --require ./dotenv.js ./node_modules/serverless/bin/serverless logs -f gtmGithubMetricCapture -t", "sls-encrypt": "chmod 755 ./encrypt.sh && ./encrypt.sh", "sls-decrypt": "node --require ./dotenv.js ./node_modules/serverless/bin/serverless decrypt -n", "agent": "export $(cat .env | grep -v ^# | xargs) && node dist/src/agent/startAgent.js", diff --git a/src/serverless/gtmGithubMetricCapture/gtmGithubMetricCapture.js b/src/serverless/gtmGithubMetricCapture/gtmGithubMetricCapture.js index 50d03cff..ecc6eca2 100644 --- a/src/serverless/gtmGithubMetricCapture/gtmGithubMetricCapture.js +++ b/src/serverless/gtmGithubMetricCapture/gtmGithubMetricCapture.js @@ -14,7 +14,7 @@ AWS.config.update({ region: process.env.GTM_AWS_REGION }); const zlib = require('zlib'); -async function handler(event, context, callback) { +function handler(event, context, callback) { if (process.env.IAM_ENABLED) { AWS.config.update({ httpOptions: { @@ -57,7 +57,7 @@ async function handler(event, context, callback) { let promises = []; - payload.logEvents.forEach(evt => { + payload.logEvents.forEach(async evt => { let msg; let isObj = true; try { @@ -184,7 +184,9 @@ async function handler(event, context, callback) { }); Promise.all(promises).then(() => { - callback(null, `Successfully processed ${payload.logEvents.length} log events.`); + let message = `Successfully processed ${payload.logEvents.length} log events.`; + console.log(message); + callback(null, message); }); }); }