[cognito] can't add cognito trigger after UserPool.fromUserPoolId
See original GitHub issueversion:
"@aws-cdk/aws-cognito": "^1.60.0",
Code
const amplifyUserPool = cognito.UserPool.fromUserPoolId(
this,
"amplifyUserPool",
"us-east-1_ABCDE"
);
console.log("addTrigger" in amplifyUserPool);
Expect
true
Receive
false
Documentation
Importing User Pools addTrigger
More
The documentation indeed mentions:
However, imported user pools have limited configurability. As a rule of thumb, none of the properties that is are part of the AWS::Cognito::UserPool CloudFormation resource can be configured.
But I am when I am using serverless framework
, it works like a charm.
Just wonder any workarounds against this? I want to move my full serverless stack to CDK, it is such a beautiful tech.
- There is a stackoverflow question against this: https://stackoverflow.com/questions/61816264/add-lambda-trigger-to-imported-cognito-user-pool-with-aws-cdk
Issue Analytics
- State:
- Created 3 years ago
- Reactions:14
- Comments:19 (5 by maintainers)
Top Results From Across the Web
Customizing user pool workflows with Lambda triggers
When you create a Lambda trigger outside of the Amazon Cognito console, you must add permissions to the Lambda function. When you add...
Read more >Post authentication Lambda trigger - Amazon Cognito
Because Amazon Cognito invokes this trigger after signing in a user, you can add custom logic after Amazon Cognito authenticates the user.
Read more >Add Lambda trigger to imported Cognito User Pool with AWS ...
This was discussed in this issue. You can add triggers to an existing User Pool using a Custom Resource: import * as CustomResources...
Read more >Creating the CustomSMS Trigger in AWS Cognito using lambda
After this let everything be default and create the userpool. ... aws cognito-idp update-user-pool --user-pool-id userpool-id --lambda-config ...
Read more >Send AWS Cognito emails with 3rd party ESPs
Create Cognito User Pool # ... This is the most confusing part. We need to set the LambdaConfig setting of the User Pool....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was not able to get the above solution working as I did not have access to the underlying
CfnUserPool
viafromUserPoolId
ornode.defaultChild
.I was however able to add triggers to a user pool imported via
fromUserPoolId
by using a custom resource:@skinny85 that worked a treat! Thank you so much 🙇🏻
For anyone else encountering this issue, the solution looks like this: