0
votes

I've a simple Alexa Skill - developed in the Alexa developer console with some simple JS in the index.js. Alexa is doing well in the Test-Tab (just responding with an 'Hello' to the launchEvent.

I now wanted to implement some logging via console.log(...)

But all I can find on information is: "Just do console.log and you'll find the output somewhere in the Cloudwatch"

But in AWS Cloudwatch, I can create "LogGroups" under "Logs" - but how do I connect such a log group with my Alexa skill? Or do the console.log outputs appear somewhere else automatically?

2
Lambda will create the log group for you if it has permission to do so. Did you try running console.log()?Dejan Peretin
Yes, I used console.log() multiple times in my javascript code. I've all permission for cloudwatch:* and for lambda:*Konrad
Logs permissions are under logs:* not cloudwatch:*Dejan Peretin

2 Answers

3
votes

Ok, the solution was not to login with my AWS/AlexaDev account into the AWS console and look in THAT cloudwatch. I've to use the "Logs: Amazon Cloudwatch"-Link in the lower left corner of the Alexa Coding View. Then I'm navigated to "another" Cloudwatch list with all my logs in it - but I'm then auto-loggedin as a complete different user: "VoiceHubSSORole"

Link to Cloudwatch in Alexa's console

Different AWS user

0
votes

You don't have to create anything on cloudwatch. Just go to cloudwatch console and click "logs" from left panel. Click the log group with the name containing your lambda function name (just make sure your lambda function has "basic execution role policy"). Now you'll see the list of logs. Just click the one with latest timestamp. Your every deployment will create a new entry in those logs. I'll suggest you sort the logs by time in descending order. Tell me me in comments if you still face any problem.

Again make sure your lambda function has the permission to write on cloudwatch.