According to https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html the parameter logRetention of lambda.Function() is deprecated and should be replaced by creating a LogGroup() object and provide that to the logGroup parameter.