Skip to content

Key have been removed from logger in lambda layer #1087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
HAK-CODE opened this issue Apr 1, 2022 · 8 comments
Closed

Key have been removed from logger in lambda layer #1087

HAK-CODE opened this issue Apr 1, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@HAK-CODE
Copy link

HAK-CODE commented Apr 1, 2022

What were you trying to accomplish?
Was trying to filter logs based on log level i.e INFO, WARN etc

Expected Behavior

arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPython:7

{
    "level": "INFO",
    "location": "lambda_handler:44",
    "message": "info message",
    "timestamp": "2022-04-01 04:41:43,576+0000",
    "service": "state-monitoring-service",
    "cold_start": true,
    "function_name": "site-state-monitoring-service",
    "function_memory_size": "128",
    "function_arn": "arn:aws:lambda:us-east-2:xxxxxxxxxxx:function:site-state-monitoring-service",
    "function_request_id": "2b37a8b5-35d0-47e7-baf9-6ee75c531c60",
    "xray_trace_id": "1-62468286-269844d9186d7242176fb362"
}

Current Behavior

arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPython:15

{
    "message": "info message",
    "service": "state-monitoring-service",
    "cold_start": true,
    "function_name": "site-state-monitoring-service",
    "function_memory_size": "128",
    "function_arn": "arn:aws:lambda:us-east-2:xxxxxxxxxxx:function:site-state-monitoring-service",
    "function_request_id": "cc1eba4c-3033-4112-9361-afaf028e22b5",
    "xray_trace_id": "1-624681d2-6b01a06a0559627628346348"
}

Current Behavior

Keys missing in current layer arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPython:15

level
location
timestamp

Steps to Reproduce (for bugs)

  1. Set the current layer arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPython:15

Environment

  • Powertools version used: via Layer
  • Packaging format (Layers, PyPi): arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPython:15
  • AWS Lambda function runtime: 3.9
@HAK-CODE HAK-CODE added bug Something isn't working triage Pending triage from maintainers labels Apr 1, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Apr 1, 2022

Thanks for opening your first issue here! We'll come back to you as soon as we can.

@HAK-CODE
Copy link
Author

HAK-CODE commented Apr 1, 2022

from aws_lambda_powertools import Logger
logger = Logger()

@logger.inject_lambda_context(clear_state=True)
def lambda_handler(event, context):
    """[process the event records to update the cache]

    Args:
        event ([dict]): [input event to lambda]
        context ([dict]): [input context of lambda]

    Returns:
        [boolean]: [return the lambda handler to service]
    """
    logger.info("info message")
    logger.warning("warning message")
    return "response"

@HAK-CODE
Copy link
Author

HAK-CODE commented Apr 1, 2022

same goes for catching exceptions.

@heitorlessa
Copy link
Contributor

Hi @HAK-CODE thanks for filing this bug report - It's a regression we are working on a patch release today -- it's happening when you use clear_state=True.

Also reported in #1084, and this regression was introduced when fixing a problem with custom formatters in 1.25.3.

@heitorlessa heitorlessa added area/logger pending-release Fix or implementation already in dev waiting to be released and removed triage Pending triage from maintainers labels Apr 1, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Apr 1, 2022

This is now released under 1.25.6 version!

@github-actions github-actions bot closed this as completed Apr 1, 2022
@github-actions github-actions bot removed the pending-release Fix or implementation already in dev waiting to be released label Apr 1, 2022
@heitorlessa
Copy link
Contributor

Thanks to your bug report we managed to reproduce and improved tests as part of the fix - the latest version 1.25.6 has this fix now. Lambda Layers upcoming version 16 will take a few hours to be available in multiple AWS commercial regions.

@heitorlessa
Copy link
Contributor

@HAK-CODE Lambda Layer version 16 is now available with the fix - Please let us know otherwise.

arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPython:16

@HAK-CODE
Copy link
Author

HAK-CODE commented Apr 1, 2022

Thanks @heitorlessa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants