Lambda not writing to logs
See original GitHub issueThis 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:
- Created 6 years ago
- Comments:6 (2 by maintainers)
@Vadorequest. that’s good to hear. thanks. I will be following your advice.
Closing, the Lambda role wasn’t setup with Cloudwatch IAM permissions. I’ve fixed that. Thanks