aws-cdk-lib/aws-cognito: Cannot use the .addTrigger() method on an existing userpool
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
I am currently unable to use the addTrigger() method on UserPool created in CDK.
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Version
_No response_
### Expected Behavior
userPool.addTrigger() should be a valid method for adding a trigger to a cognito user pool. Type hints should be available and working in any modern IDE.
### Current Behavior
When attempting to call the addTrigger() method on a userpool, CDK fails to compile and states the method does not exist.
```
TSError: ⨯ Unable to compile TypeScript:
lib/stacks/myStack.ts:106:25 - error TS2339: Property 'addTrigger' does not exist on type 'IUserPool'.
106 cognitoUserPool.addTrigger()
```
### Reproduction Steps
```TypeScript
const cognitoUserPool = new UserPool(this, 'UserPool', {
selfSignUpEnabled: true,
accountRecovery: AccountRecovery.PHONE_AND_EMAIL,
userVerification: {
emailStyle: VerificationEmailStyle.CODE,
},
autoVerify: {
email: true,
},
standardAttributes: {
email: {
required: true,
mutable: true,
},
},
});
// This does not work, even if the correct props are provided
cognitoUserPool.addTrigger()
```
### Possible Solution
_No response_
### Additional Information/Context
I've attempted updating version, invalidating caches, removing node_modules and reinstalling.
### CDK CLI Version
2.178.1
### Framework Version
_No response_
### Node.js Version
v18.19.1
### OS
Ubuntu 24
### Language
TypeScript
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
Start by locating the IUserPool type and the UserPool API used in the TypeScript reproduction. Check how addTrigger is exposed or omitted, then compile the provided example to confirm the expected method and type hints are available on an existing user pool.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- authentication, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100