question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lambda not writing to logs

See original GitHub issue

This is a Bug Report

Description

With a simple python 3.6 lambda script, I am able to deploy to AWS and run my lambda function. The logging is not setup by serverless, and no logging takes place. In addition, when I insert logging into my code that lambda calls, the function appears to crash.

Further info: I am deploying using aws-profile: serverless deploy --aws-profile deployer

Perhaps I am overlooking some config option, but I’ve looked through the docs and the forum and haven’t been able to resolve the issue after much trial and error with the deployment process.

For bug reports:

  • What went wrong?

Logging does not work from Lambda. There is a Log Group setup, but no Log Stream events are ever created.

  • What did you expect should have happened?

Logging setup in AWS cloudwatch by serverless. Logs are created when logging is called from the Lambda function.

  • What was the config you used?

Setup files are simplified & pasted below. The current initial lambda function does not do much, but logging is not working.

serverless.yml

service: cmd-demo

provider:
  name: aws
  runtime: python3.6
  role: arn:aws:iam::123456789123:role/service-role/demoDeployer

package:
  include:
    - handler.py
  exclude:
    - requirements.txt
    - serverless.yml

functions:
  test:
    handler: handler.test
    events:
      - http:
          path: cmd
          method: post

handler.py

import sys
sys.path.append("./lib")

def test(event,context):
  print("testing log")
  • What stacktrace or error message from your provider did you see?

Getting different errors from serverless, while trying different solutions:

  • The specified log group does not exist.
  • An error occurred while provisioning your stack: RespondLogsSubscriptionFilterCloudWatchLog1 - The specified log group does not exist…
  • An error occurred while provisioning your stack: RespondLogsSubscriptionFilterCloudWatchLog1 - The log group provided is reserved for the function logs of the destination function…
  • Stack:arn:aws:cloudformation:us-east-1:[ARN_HERE] is in UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS state and can not be updated.
  • No existing streams for the function

For feature proposals:

  • What is the use case that should be solved. The more detail you describe this in the easier it is to understand for us.
  • If there is additional config how would it look

N/A

Similar or dependent issues:

Did not find a match

Additional Data

  • Serverless Framework Version you’re using:

1.19.0

  • Operating System:

macOS with AWS

  • Stack Trace:

N/A. If there is one I can provide, please let me know how I can provide it. Thanks

  • Provider Error messages:

See above “What stacktrace or error message from your provider did you see?”

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
samsammurphycommented, Mar 11, 2018

@Vadorequest. that’s good to hear. thanks. I will be following your advice.

2reactions
xtacommented, Aug 11, 2017

Closing, the Lambda role wasn’t setup with Cloudwatch IAM permissions. I’ve fixed that. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix "Log group does not exist" for Lambda logs in CloudWatch
Logs are generated after you run your function for the first time. If there's no log group after invoking the function, it's usually...
Read more >
Debugging with Dashbird: Lambda not logging to CloudWatch
The less obvious, but still likely, cause is that your Lambda function doesn't have permissions to write log data to CloudWatch. This usually ......
Read more >
Can't get AWS Lambda function to log (text output) to ...
I assigned another role and logs still did not work. What ended up working for me was clicking "Create a custom role", then...
Read more >
Lambda logging to CloudWatch seems to be broken?
For some reason, one of my Lambda's logs are no longer appearing on CloudWatch. I see output from a Test run in the...
Read more >
How do I fix "Log group does not exist" errors for Lambda ...
How do I fix " Log group does not exist" errors for Lambda function logs in the CloudWatch console?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found