New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lambda Triggers auto detached after updates to Cognito #8997
Comments
I was able to reproduce this bug following the steps provided above |
Got the same thing after upgrade to CLI. 7.5.x (updated to latest 7.5.4 for latest test) when pushing the latest changes all triggers where wiped out. |
@wbroek yes the migration is mandatory because the underlying implementation changed to use the CDK from the previous static EJS templates and also some state files in certain categories are refactored to use the new |
👋 Hi, this issue was referenced in the v7.6.5 release! Check out the release notes here https://github.com/aws-amplify/amplify-cli/releases/tag/v7.6.5. |
@akshbhu , I just built with v7.6.5 and the Cognito triggers are still being removed. In order to fix it I had to add this code in the override.ts: // START - Lambda Triggers
// This is being done because the generated stack is missing Cognito triggers - Don't know why
const newLambdaConfig = {
...resources.userPool.lambdaConfig,
};
if (!newLambdaConfig["preSignUp"]) {
newLambdaConfig["preSignUp"] = {
"Ref": "functionmyprojectauthPreSignupArn"
};
}
resources.userPool.lambdaConfig = newLambdaConfig
// END - Lambda Triggers What I find strange is that the CloudFormation parameter functionmyprojectauthPreSignupArn is available but not set. I also have a post confirmation trigger and that one is being correctly set. No need to do anything in the override.ts for that one. |
I think there is an issue with the case difference between SignUp and signup. See this issue #9351 |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Before opening, please confirm:
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
14.17.4
Amplify CLI Version
7.4.4
What operating system are you using?
MacOS 10
Amplify Categories
auth
Amplify Commands
push, update
Describe the bug
Cognito lambda triggers getting automatically detached while pushing any updates to Cognito configuration.
Note: Not regarding updates to lambda function itself but to Cognito configurations like change of password policy etc.
It's clear that the approach for attaching triggers to Cognito is through an authTriggerFn function. From logs I cannot see an invocation after update here in this new version but old version used to get a delete which was causing similar trouble. But in all cases triggers gets detached automatically after any updates to Cognito cloudformation.
This is consistent across amplify versions 5, 6 & 7 at least.
I have reproduced this in a minimal code base here: https://github.com/gorbinphilip1/amplify-cognito-trigger-sample
Expected behavior
After update Cognito should retain previously attached lambda triggers.
Reproduction steps
Simply put steps to reproduce is to
amplify push
after altering auth category usingamplify auth update
Please find the steps below that I used to reproduce this myself in a minimal code base
GraphQL schema(s)
# Put schemas below this line
Log output
Additional information
No response
The text was updated successfully, but these errors were encountered: