Skip to content

aws-lambda-event-sources: aws-cdk-lib.aws_iam.GrantOnPrincipalOptions#scope is deprecated. #36289

@jdelStrother

Description

@jdelStrother

Describe the bug

Not sure if deprecation warnings are considered bugs, but thought it was worth reporting just in case.

If I connect a dynamodb event source to a lambda function, I get a deprecation warning on aws-cdk-lib.aws_iam.GrantOnPrincipalOptions#scope

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Library Version

2.138.0

Expected Behavior

No deprecations are printed for using DynamoEventSource as documented. (Apologies if I'm missing something and using it incorrectly)

Current Behavior

This is printed:

[WARNING] aws-cdk-lib.aws_iam.GrantOnPrincipalOptions#scope is deprecated.
  The scope argument is currently unused.
  This API will be removed in the next major release.

Reproduction Steps

This seems to be a minimal reproduction:

    const fn = new lambda.Function(this, "MyFunction", {
      runtime: lambda.Runtime.PYTHON_3_11,
      handler: "index.handler",
      code: lambda.Code.fromInline(
        'def handler(event, context): return "Hello"',
      ),
    });
    const dynamoDBMetricsTable = new dynamodb.Table(this, "MetricsTable", {
      partitionKey: { name: "podcast_id", type: dynamodb.AttributeType.NUMBER },
      stream: dynamodb.StreamViewType.KEYS_ONLY,
    });
    fn.addEventSource(
      new DynamoEventSource(dynamoDBMetricsTable, {
        startingPosition: lambda.StartingPosition.LATEST,
        batchSize: 50,
        maxBatchingWindow: cdk.Duration.seconds(300),
        bisectBatchOnError: true,
      }),
    );

Possible Solution

No response

Additional Information/Context

No response

AWS CDK Library version (aws-cdk-lib)

2.231.0

AWS CDK CLI version

2.1033.0 (build 1ec3310)

Node.js Version

22.20

OS

macOS 15.7.1

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions