Skip to content

aws-lambda: Log format option is not typed #28114

Closed
@regoawt

Description

Describe the bug

The logFormat option in the FunctionOptions interface is untyped, meaning that it does not accept the LogFormat enum.

See line 469 of https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-lambda/lib/function.ts.

It has also been mentioned in #28039 (comment).

Expected Behavior

It should accept one of the LogFormat enum options.

Current Behavior

It doesn't accept the LogFormat enum so you have to specify a string "JSON" or "TEXT", which is not type-safe.

Reproduction Steps

N/A

Possible Solution

It should be typed as

readonly logFormat?: LogFormat;

Additional Information/Context

No response

CDK CLI Version

2.110.1

Framework Version

No response

Node.js Version

20.9.0

OS

MacOS

Language

Python

Language Version

3.11.2

Other information

No response

Metadata

Labels

@aws-cdk/aws-lambdaRelated to AWS LambdabugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions