Skip to content

Bug: regression when passing null as extra arg in logging methods #3613

Closed
@arturldev

Description

@arturldev

Expected Behavior

Minor releases should not have breaking changes and minor upgrade should be effortless (see https://docs.npmjs.com/about-semantic-versioning).

The following code:

logger.info('Hello World', null);

Works fine in version 2.13.1 and below, but breaks in version 2.14.0 and throws an error:

TypeError: Cannot convert undefined or null to object

Current Behavior

logger.info('Hello World', null);

Throws an error:

TypeError: Cannot convert undefined or null to object

Code snippet

logger.info('Hello World', null);

Steps to Reproduce

logger.info('Hello World', null);

Possible Solution

No response

Powertools for AWS Lambda (TypeScript) version

2.14.0

AWS Lambda function runtime

20.x

Packaging format used

Lambda Layers

Execution logs

{     "errorType": "TypeError",     "errorMessage": "Cannot convert undefined or null to object",     "stack": [         "TypeError: Cannot convert undefined or null to object",         "    at Function.entries (<anonymous>)",         "    at #processExtraObject (/opt/nodejs/node_modules/@aws-lambda-powertools/logger/lib/cjs/Logger.js:678:43)",         "    at #processExtraInput (/opt/nodejs/node_modules/@aws-lambda-powertools/logger/lib/cjs/Logger.js:670:41)",         "    at Logger.createAndPopulateLogItem (/opt/nodejs/node_modules/@aws-lambda-powertools/logger/lib/cjs/Logger.js:624:32)",         "    at Logger.processLogItem (/opt/nodejs/node_modules/@aws-lambda-powertools/logger/lib/cjs/Logger.js:780:46)",         " at Logger.debug (/opt/nodejs/node_modules/@aws-lambda-powertools/logger/lib/cjs/Logger.js:256:14)"

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcompletedThis item is complete and has been merged/shippedloggerThis item relates to the Logger Utility

Type

No type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions