Skip to content

logRetention field is deprecated, logGroup is required #2965

@nsteffens

Description

@nsteffens

Environment information

❯ npx ampx info                                                                                                                                                                                           
System:
  OS: macOS 15.6
  CPU: (12) arm64 Apple M3 Pro
  Memory: 193.63 MB / 36.00 GB
  Shell: /bin/zsh
Binaries:
  Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node
  Yarn: undefined - undefined
  npm: 10.9.2 - ~/.nvm/versions/node/v22.14.0/bin/npm
  pnpm: undefined - undefined
NPM Packages:
  @aws-amplify/auth-construct: 1.8.1
  @aws-amplify/backend: 1.16.1
  @aws-amplify/backend-ai: Not Found
  @aws-amplify/backend-auth: 1.7.1
  @aws-amplify/backend-cli: 1.8.0
  @aws-amplify/backend-data: 1.6.1
  @aws-amplify/backend-deployer: 2.1.3
  @aws-amplify/backend-function: 1.14.1
  @aws-amplify/backend-output-schemas: 1.7.0
  @aws-amplify/backend-output-storage: 1.3.1
  @aws-amplify/backend-secret: 1.4.0
  @aws-amplify/backend-storage: 1.4.1
  @aws-amplify/cli-core: 2.2.1
  @aws-amplify/client-config: 1.8.0
  @aws-amplify/data-construct: 1.16.3
  @aws-amplify/data-schema: 1.21.1
  @aws-amplify/deployed-backend-client: 1.8.0
  @aws-amplify/form-generator: 1.2.4
  @aws-amplify/model-generator: 1.2.0
  @aws-amplify/platform-core: 1.10.0
  @aws-amplify/plugin-types: 1.11.0
  @aws-amplify/sandbox: 2.1.2
  @aws-amplify/schema-generator: 1.4.0
  @aws-cdk/toolkit-lib: 1.1.1
  aws-amplify: 6.15.5
  aws-cdk-lib: 2.211.0
  typescript: 5.9.2
AWS environment variables:
  AWS_PROFILE = XXXXXXXXXXXXXXXXX

Describe the bug

I have a very simple lambda function added:

import { defineFunction } from "@aws-amplify/backend";

export const taskDispatcher = defineFunction({
  name: "task-dispatcher",
  entry: "./handler.ts",
  timeoutSeconds: 10,
  logging: {
    retention: "1 month",
  },
});

This compiles fine, still shows this warning for all of my lambdas:

3:58:11 PM [WARNING] aws-cdk-lib.aws_lambda.FunctionOptions#logRetention is deprecated.
3:58:11 PM   use `logGroup` instead
3:58:11 PM   This API will be removed in the next major release.

Furthermore, the whole logging field is not documented. I only found out about this by accident in a PR in this repo..

Reproduction steps

Use the example above. Run it. Warning appears.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions