Tom
Tom

Reputation: 6004

Access Amazon Alexa Console console.log() content

I'm using the online based Amazon Alexa Console test suite and AWS Lambda for the development of an Alexa skill. How to access the content of console.log('STATE: ' + stateAbbreviation)?

Lambda Function Code:

function getSmallImage(stateAbbreviation) {
  console.log('STATE: ' + stateAbbreviation);
  return getImageUrl(400, 720, stateAbbreviation);
}

Upvotes: 5

Views: 4841

Answers (1)

johndoe
johndoe

Reputation: 4387

CloudWatch is the one which you are looking for.

Each time when a Lambda code is executed in response to an event, it writes a log entry into the log group associated with a Lambda function, which is /aws/lambda/<function name>. You can access this log entry using CloudWatch.

To access CloudWatch:

  1. Goto the Monitoring tab of the Lambda function.
  2. Then click on View logs in CloudWatch.

Lambda function

  1. Select the latest stream to view the most recent log entries.

If you are under development and is using the in-line code editor of Lambda function, you can make use of Test feature to create a test event. In case of Alexa, you can create test events with the request JSON of Alexa. And when you fire a test event the Lambda function gets executed and the logs will be displayed right inside Execution Results tab of the code editor.

Upvotes: 5

Related Questions