File tree 1 file changed +17
-1
lines changed
packages/aws-cdk-lib/core/lib/stack-synthesizers
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,23 @@ function collectStackMetadata(stack: Stack) {
100
100
101
101
if ( node . node . metadata . length > 0 ) {
102
102
// Make the path absolute
103
- output [ Node . PATH_SEP + node . node . path ] = node . node . metadata . map ( md => stack . resolve ( md ) as cxschema . MetadataEntry ) ;
103
+ output [ Node . PATH_SEP + node . node . path ] = node . node . metadata . map ( md => {
104
+ // If Annotations include a token, the message is resolved and output as `[object Object]` after synth
105
+ // because the message will be object type using 'Fn::Join'.
106
+ // It would be easier for users to understand if the message from Annotations were output in token form,
107
+ // rather than in `[object Object]` or in object type using 'Fn::Join'.
108
+ // Therefore, we don't resolve the message if it's from Annotations.
109
+ if ( [
110
+ cxschema . ArtifactMetadataEntryType . ERROR ,
111
+ cxschema . ArtifactMetadataEntryType . WARN ,
112
+ cxschema . ArtifactMetadataEntryType . INFO ,
113
+ ] . includes ( md . type as cxschema . ArtifactMetadataEntryType ) ) {
114
+ return md ;
115
+ }
116
+
117
+ const resolved = stack . resolve ( md ) ;
118
+ return resolved as cxschema . MetadataEntry ;
119
+ } ) ;
104
120
}
105
121
106
122
for ( const child of node . node . children ) {
You can’t perform that action at this time.
0 commit comments