Skip to content

CfnResource#addDependency deprecation warnings during pipeline-deploy synthesis #3294

Description

@fomson

Environment information

System:
  OS: macOS 15.0.1
  CPU: (8) arm64 Apple M1
  Memory: 194.19 MB / 16.00 GB
  Shell: /bin/zsh
Binaries:
  Node: 22.12.0 - /usr/local/bin/node
  Yarn: 1.22.22 - /usr/local/bin/yarn
  npm: 11.0.0 - /usr/local/bin/npm
  pnpm: undefined - undefined
NPM Packages:
  @aws-amplify/auth-construct: 1.11.2
  @aws-amplify/backend: 1.23.0
  @aws-amplify/backend-ai: Not Found
  @aws-amplify/backend-auth: 1.9.4
  @aws-amplify/backend-cli: 1.8.3
  @aws-amplify/backend-data: 1.7.0
  @aws-amplify/backend-deployer: 2.1.7
  @aws-amplify/backend-function: 1.18.1
  @aws-amplify/backend-output-schemas: 1.8.0
  @aws-amplify/backend-output-storage: 1.3.5
  @aws-amplify/backend-secret: 1.4.2
  @aws-amplify/backend-storage: 1.5.0
  @aws-amplify/cli-core: 2.2.5
  @aws-amplify/client-config: 1.10.2
  @aws-amplify/data-construct: 1.17.7
  @aws-amplify/data-schema: 1.26.0
  @aws-amplify/deployed-backend-client: 1.8.2
  @aws-amplify/form-generator: 1.2.7
  @aws-amplify/model-generator: 1.2.3
  @aws-amplify/platform-core: 1.11.1
  @aws-amplify/plugin-types: 1.12.1
  @aws-amplify/sandbox: 2.2.1
  @aws-amplify/schema-generator: 1.4.1
  @aws-cdk/toolkit-lib: 1.19.0
  aws-amplify: 6.18.0
  aws-cdk-lib: 2.261.0
  typescript: 5.9.3
CDK CLI Version: 2.1133.0 (build 712d792)

Describe the bug

During ampx pipeline-deploy, the CDK synthesis phase emits 200+ deprecation warnings:

[WARNING] aws-cdk-lib.CfnResource#addDependency is deprecated.
Use addResourceDependency instead.
This API will be removed in the next major release.
These originate from Amplify's internal constructs (@aws-amplify/data-construct, @aws-amplify/graphql-api-construct), not from user code. Our backend.ts does not call addDependency anywhere — confirmed via grep -rn "addDependency" amplify/ --include="*.ts" returning zero results.

The warnings are cosmetic (deployment succeeds), but they add ~500 lines of noise to build logs and will become breaking errors when CDK removes the deprecated API in its next major release.

Reproduction steps

  1. Create an Amplify Gen 2 project with any GraphQL schema containing @model directives
  2. Deploy via Amplify Hosting CI/CD (ampx pipeline-deploy) or run npx ampx sandbox
  3. Observe the build log — hundreds of CfnResource#addDependency is deprecated warnings appear during the "Synthesizing backend..." phase
  4. No user code references addDependency — all calls come from internal Amplify/CDK construct libraries

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependencyIssue related to upstream dependencypending-maintainer-responseIssue is pending a response from the Amplify team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions