Skip to content

(annotations): annotations that include tokens are output as [object Object] #33707

Closed
@swachter

Description

@swachter

Describe the bug

If a stack with name 'some-stack' includes an info annotation

Annotations.of(this).addInfo(`stackId: ${this.stackId}`);

then the following output results:

[Info at /some-stack] [object Object]

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

The string representation of the token should be output.

Current Behavior

The message is output as "[object Object]"

Reproduction Steps

class MyStack extends Stack {
  constructor(scope: Construct, id: string) {
    super(scope, id)
    Annotations.of(this).addInfo(`stackId: ${this.stackId}`)
  }
}

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.1000.2 (build bc82193)

Framework Version

No response

Node.js Version

v22.12.0

OS

Ubuntu

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.p1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions