Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Lambda error There was an error loading Log Streams

When I go to the Logs page the below error shows.

There was an error loading Log Streams. Please try again by refreshing this page.

Problem is there is another function that is identical except the code that is creating log files no problem.

Any suggestions?

like image 704
user3757731 Avatar asked Aug 10 '18 13:08

user3757731


2 Answers

I solved it.

I added CloudwatchLogsFullAccess and then it took some time under an hour and then it was working.

I'm not sure why I needed to do this for the second function but not the first but it's working now.

Below is the link that helped me.

https://blogs.perficient.com/2018/02/12/error-loading-log-streams/

like image 66
user3757731 Avatar answered Oct 14 '22 11:10

user3757731


Make sure your Lambda has already logged at least once!

Appears to me that this error occurs if that is not the case - I've tested fresh Lambdas both with and without any log statements to confirm: Without any log statements, a corresponding Log Group for the Lambda does not exist yet; after the first log statement is made, the statement then exists in a seemingly-newly-made corresponding Log Group.

Although this may seem obvious/intuitive after-the-fact, this is how I ran into this scenario: I think before any logging had occurred on my new Lambda, I tried to hook it up to CloudWatch events - I tried after that attempt to see if the Lambda was invoked (by the events) via viewing 'Monitoring' tab -> 'View logs in CloudWatch' button - and that is where I encountered this error. The Lambda had not been invoked [CloudWatch events hookup had failed], so no logging had occurred, and thus there was no corresponding Log Group made yet to examine (when trying to hyperlink into it from the Lambda Configuration).

(Fwiw, I imagine maybe a corresponding Log Group could be manually made before the first logging, but I have not tested that.)

like image 32
cellepo Avatar answered Oct 14 '22 11:10

cellepo