Skip to content
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

(@aws-cdk/aws-lambda): (missing logGroup property in type FunctionProps in 2.132.0) #29439

Closed
modosm opened this issue Mar 11, 2024 · 4 comments
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. p2

Comments

@modosm
Copy link

modosm commented Mar 11, 2024

Describe the bug

Missing logGroup property in type FunctionProps in 2.132.0. This was working in 2.131.0.

error TS2345: Argument of type '{ runtime: cdk.aws_lambda.Runtime; handler: string; code: cdk.aws_lambda.AssetCode; functionName: string; logGroup: cdk.aws_logs.LogGroup; }' is not assignable to parameter of type 'FunctionProps'.
 Object literal may only specify known properties, and 'logGroup' does not exist in type 'FunctionProps'.

162       logGroup: new logs.LogGroup(this, 'LogGroup', {}),
         ~~~~~~~~

Expected Behavior

FunctionProps has logGroup property.

Current Behavior

lib/cdk-stack.ts:162:7 - error TS2345: Argument of type '{ runtime: cdk.aws_lambda.Runtime; handler: string; code: cdk.aws_lambda.AssetCode; functionName: string; logGroup: cdk.aws_logs.LogGroup; }' is not assignable to parameter of type 'FunctionProps'.
  Object literal may only specify known properties, and 'logGroup' does not exist in type 'FunctionProps'.

162       logGroup: new logs.LogGroup(this, 'LogGroup', {}),

Reproduction Steps

import { LogGroup } from 'aws-cdk-lib/aws-logs';

const myLogGroup = new LogGroup(this, 'MyLogGroupWithLogGroupName', {
  logGroupName: 'customLogGroup',
});

new lambda.Function(this, 'Lambda', {
  code: new lambda.InlineCode('foo'),
  handler: 'index.handler',
  runtime: lambda.Runtime.NODEJS_18_X,
  logGroup: myLogGroup,
});

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

1.132.0

Framework Version

No response

Node.js Version

node/18.19.0

OS

MacOS Ventura 13.6.4

Language

TypeScript

Language Version

No response

Other information

No response

@modosm modosm added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 11, 2024
@github-actions github-actions bot added the @aws-cdk/aws-lambda Related to AWS Lambda label Mar 11, 2024
@pahud
Copy link
Contributor

pahud commented Mar 11, 2024

I think it's still supported:

export class DummyStack extends Stack {
  constructor(scope: Construct, id: string, props: StackProps) {
    super(scope, id, props);

    const myLogGroup = new logs.LogGroup(this, 'MyLogGroupWithLogGroupName', {
      logGroupName: 'customLogGroup',
    });
    
    new lambda.Function(this, 'Lambda', {
      code: new lambda.InlineCode('foo'),
      handler: 'index.handler',
      runtime: lambda.Runtime.NODEJS_18_X,
      logGroup: myLogGroup,
    });

  }
}

synth:

   Type: AWS::Lambda::Function
    Properties:
      Code:
        ZipFile: foo
      Handler: index.handler
      LoggingConfig:
        LogGroup:
          Ref: MyLogGroupWithLogGroupNameB577EB65

Can you verify both your CLI and aws-cdk-lib version are 2.132.0?

% grep aws-cdk-lib package.json
"aws-cdk-lib": "2.132.0",
% npx cdk --version
2.132.0 (build 9a51c89)

@pahud pahud added p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Mar 11, 2024
@modosm
Copy link
Author

modosm commented Mar 12, 2024

Issue still persists.

"aws-cdk-lib": "2.132.0",

pnpm exec cdk --version
2.132.1 (build 9df7dd3)

edit:
Meanwhile noticed that 2.132.1 was released. Installed it and solved the problem.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Mar 12, 2024
@pahud
Copy link
Contributor

pahud commented Mar 13, 2024

Meanwhile noticed that 2.132.1 was released. Installed it and solved the problem.

Thank you. I am resolving this issue for now.

@pahud pahud closed this as completed Mar 13, 2024
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. p2
Projects
None yet
Development

No branches or pull requests

2 participants