From 81b18614363da960a5cc9dc6068b8671d610baaa Mon Sep 17 00:00:00 2001 From: Luciano Mammino Date: Mon, 18 Dec 2023 18:54:49 +0100 Subject: [PATCH 1/2] Fix: messages from annotations.ts somehow shows up as [object Object] --- packages/aws-cdk-lib/core/lib/annotations.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/aws-cdk-lib/core/lib/annotations.ts b/packages/aws-cdk-lib/core/lib/annotations.ts index 19e83f0ec43af..33176e43075ab 100644 --- a/packages/aws-cdk-lib/core/lib/annotations.ts +++ b/packages/aws-cdk-lib/core/lib/annotations.ts @@ -143,7 +143,8 @@ export class Annotations { private addMessage(level: string, message: string) { const isNew = !this.scope.node.metadata.find((x) => x.data === message); if (isNew) { - this.scope.node.addMetadata(level, message, { stackTrace: this.stackTraces }); + let normalizedMessage = typeof message === "string" ? message : JSON.stringify(message); + this.scope.node.addMetadata(level, normalizedMessage, { stackTrace: this.stackTraces }); } } } @@ -259,4 +260,4 @@ function removeWarning(construct: IConstruct, id: string) { function ackTag(id: string) { return `[ack: ${id}]`; -} \ No newline at end of file +} From 27d41c5e52aa37adb7bc9d1c280cbede44cf32db Mon Sep 17 00:00:00 2001 From: Kaizen Conroy <36202692+kaizencc@users.noreply.github.com> Date: Mon, 18 Dec 2023 10:14:44 -0800 Subject: [PATCH 2/2] Update packages/aws-cdk-lib/core/lib/annotations.ts --- packages/aws-cdk-lib/core/lib/annotations.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/core/lib/annotations.ts b/packages/aws-cdk-lib/core/lib/annotations.ts index 33176e43075ab..2d5d75dab3ef0 100644 --- a/packages/aws-cdk-lib/core/lib/annotations.ts +++ b/packages/aws-cdk-lib/core/lib/annotations.ts @@ -143,7 +143,7 @@ export class Annotations { private addMessage(level: string, message: string) { const isNew = !this.scope.node.metadata.find((x) => x.data === message); if (isNew) { - let normalizedMessage = typeof message === "string" ? message : JSON.stringify(message); + let normalizedMessage = typeof message === 'string' ? message : JSON.stringify(message); this.scope.node.addMetadata(level, normalizedMessage, { stackTrace: this.stackTraces }); } }