Skip to content

[aws-dynamodb] when setting PhysicalName.GENERATE_IF_NEEDED to tableName, throwing error Invalid physical name passed to CloudFormation. Use "this.physicalName" instead #9374

@flyingImer

Description

@flyingImer

Hi team, I'm trying to do a cross-env reference on a ddb table. After I specify the tableName to PhysicalName.GENERATE_IF_NEEDED, synthesizing process breaks.

The error message says:

Error: Resolution error: Invalid physical name passed to CloudFormation. Use "this.physicalName" instead.

I suspect this is a bug, as my experiment on a cross-env referenced IAM role works just fine with PhysicalName.GENERATE_IF_NEEDED (not included in the example below)

And I think this error message is confusing. I have no idea what to do with this message. Any context how should I interpret it?

Reproduction Steps

here is an example I used: https://github.com/flyingImer/cdk-mkii

cdk synth breaks even without SomeStack referencing to the ddb table defined in CdkMkiiStack

Error Log

Error: Resolution error: Invalid physical name passed to CloudFormation. Use "this.physicalName" instead.
    at GeneratedWhenNeededMarker.resolve (/Users/Can/ws-local/github/cdk-mkii/node_modules/@aws-cdk/core/lib/private/physical-name-generator.ts:89:11)
    at DefaultTokenResolver.resolveToken (/Users/Can/ws-local/github/cdk-mkii/node_modules/@aws-cdk/core/lib/resolvable.ts:134:24)
    at resolve (/Users/Can/ws-local/github/cdk-mkii/node_modules/@aws-cdk/core/lib/private/resolve.ts:133:29)
    at Object.resolve [as mapToken] (/Users/Can/ws-local/github/cdk-mkii/node_modules/@aws-cdk/core/lib/private/resolve.ts:49:32)
    at TokenizedStringFragments.mapTokens (/Users/Can/ws-local/github/cdk-mkii/node_modules/@aws-cdk/core/lib/string-fragments.ts:71:33)
    at DefaultTokenResolver.resolveString (/Users/Can/ws-local/github/cdk-mkii/node_modules/@aws-cdk/core/lib/resolvable.ts:155:22)
    at resolve (/Users/Can/ws-local/github/cdk-mkii/node_modules/@aws-cdk/core/lib/private/resolve.ts:91:31)
    at Object.resolve (/Users/Can/ws-local/github/cdk-mkii/node_modules/@aws-cdk/core/lib/private/resolve.ts:49:32)
    at Object.resolve (/Users/Can/ws-local/github/cdk-mkii/node_modules/@aws-cdk/core/lib/private/resolve.ts:155:39)
    at CdkMkiiStack.resolve (/Users/Can/ws-local/github/cdk-mkii/node_modules/@aws-cdk/core/lib/stack.ts:363:12)

Environment

  • CLI Version : 1.55.0 (build 48ccf09)
  • Framework Version: 1.55.0
  • Node.js Version: v12.16.2
  • OS : macOS 10.15.6
  • Language (Version): TypeScript

Other


This is 🐛 Bug Report

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-dynamodbRelated to Amazon DynamoDBbugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions