aws / aws/aws-cdk

triggers: Trigger provider does not show up in construct tree

Open
#29,657 1 comment 0 reactions 0 assignees View on GitHub
@aws-cdk/triggers bug effort/small p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

The Trigger provider construct and its children don't seem to be showing up in the Construct tree. This means that it can't be used with Aspects to apply tags or execute any kind of overrides.

### Expected Behavior

1. This should return the trigger resource provider.

```typescript
const triggerCustomResourceProvider = stack.node.tryFindChild(
"AWSCDK.TriggerCustomResourceProvider",
);
```

2. Similarly, this should allow me to make modifications to the Trigger resources
```typescript
Aspects.of(stack).add(new SomeModificationToTrigger());
```

### Current Behavior

1. `tryFindChild` returns undefined
2. Aspects does not pass the class any of the children resources of the Trigger Provider
3. Listing the entire construct tree via `console.log(stack.node.findAll().map((n) => n.node.path));` does not show the Trigger provider constructs

### Reproduction Steps

This was tested in two places: Fine-grained assertion tests and Python code using the published code from a custom CDK library.

### Possible Solution

Convert [this](https://github.com/aws/aws-cdk/blob/ac4b32a4a5c2669905bca0024a74f06b90025560/packages/aws-cdk-lib/triggers/lib/trigger.ts#L117) to a class property to be accessible by end users.

~Possibly the use of a `.` in the [construct ID](https://github.com/aws/aws-cdk/blob/df48fd781a476ada79b6b49f006a60f33f73d409/packages/aws-cdk-lib/triggers/lib/trigger.ts#L117) is causing this? Could it be as simple as maybe removing that or switching to a `-`?`~

Disregard previous hypothesis. I was able to add a construct with a `.` and it was listed in `findAll()`.

### Additional Information/Context

_No response_

### CDK CLI Version

2.131.0

### Framework Version

_No response_

### Node.js Version

20

### OS

macOS Sonoma

### Language

TypeScript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Inspect packages/aws-cdk-lib/triggers/lib/trigger.ts at the referenced line, then reproduce the issue with tryFindChild, findAll(), and Aspects as described. Done means the Trigger provider and its children appear in the construct tree and are reachable for aspect-based modifications.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.