When I pass a custom resource to a nested stack via props, and then use getAttString() on the custom resource with an input of something like Fn.ref(AWS::Region), when I call app.synth(), I get TypeError: id.replace is not a function.
Expected Behavior
I expect this to work as it does when the custom resource is created in the nested stack. This error does not occur if the custom resource is not passed across stacks via props.
Current Behavior
TypeError: id.replace is not a function
9 | const stack = new BugStack(app, 'MyTestStack');
10 |
> 11 | app.synth();
| ^
12 |
13 | const template = Template.fromStack(stack);
14 | });
at sanitizeId (node_modules/constructs/src/construct.ts:552:13)
at Node.tryFindChild (node_modules/constructs/src/construct.ts:119:27)
at createNestedStackParameter (node_modules/aws-cdk-lib/core/lib/private/refs.js:1:6613)
at resolveValue (node_modules/aws-cdk-lib/core/lib/private/refs.js:1:3177)
at resolveReferences (node_modules/aws-cdk-lib/core/lib/private/refs.js:1:1516)
at prepareApp (node_modules/aws-cdk-lib/core/lib/private/prepare-app.js:1:904)
at synthesize (node_modules/aws-cdk-lib/core/lib/private/synthesis.js:1:1632)
at App.synth (node_modules/aws-cdk-lib/core/lib/stage.js:1:2365)
at Object.<anonymous> (test/bug.test.ts:11:9)
Describe the bug
When I pass a custom resource to a nested stack via props, and then use
getAttString()
on the custom resource with an input of something likeFn.ref(AWS::Region)
, when I callapp.synth()
, I getTypeError: id.replace is not a function
.Expected Behavior
I expect this to work as it does when the custom resource is created in the nested stack. This error does not occur if the custom resource is not passed across stacks via props.
Current Behavior
TypeError: id.replace is not a function
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.138.0 (build 6b41c8b)
Framework Version
No response
Node.js Version
v20.9.0
OS
darwin
Language
TypeScript
Language Version
No response
Other information
No response