[aws-dynamodb] when setting PhysicalName.GENERATE_IF_NEEDED to tableName, throwing error `Invalid physical name passed to CloudFormation. Use "this.physicalName" instead`
See original GitHub issueHi 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
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
AWS CDK - class PhysicalName
Use this to automatically generate a physical name for an AWS resource only if the resource is referenced across environments (account/region). Otherwise, the ......
Read more >Referencing !Ref DynamoDB table name in a AWS ...
From all the documentation I have read, I should be able to reference the the TableName property value of a DynamoDB resource using...
Read more >Don't assign names to CDK resources | bobbyhadz
The drawbacks of explicitly assigning Names in AWS CDK #. When we create a CDK resource and explicitly set its name we are...
Read more >AWS Infrastructure Resources - Serverless Framework
Every stage you deploy to with serverless.yml using the aws provider is a single AWS CloudFormation stack. This is where your AWS Lambda...
Read more >@aws-cdk/custom-resources - npm
Implements default behavior for physical resource IDs. The following code shows how the Provider construct is used in conjunction with a ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yep, I think it’s in the DynamoDB library. I should have a fix out soon.
@isaiahvita are you 100% sure the problem is with this code? Not somewhere else?