-
Notifications
You must be signed in to change notification settings - Fork 816
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
Trigger changed to initial default after every deployment #9229
Comments
Hi @kevinRR this is more of a CLI issue but I believe this is the expected behavior. If you change resources in the console, your local project won't know about it and the next time you run So, I think the only way to avoid this is to setup the trigger through the CLI by running |
@chrisbonifacio , I'm having the exact same issue in multiple projects. In one of these projects it's always the same Cognito trigger that appears blank all the time. In the other one it's all of them. I've tried multiple combinations of The I'm trying right now to override them using the new override functionality but there's definitely a bug somewhere. |
@kevinRR , I fixed this with:
My override.ts looks like this: import { AmplifyAuthCognitoStackTemplate } from '@aws-amplify/cli-extensibility-helper';
export function override(resources: AmplifyAuthCognitoStackTemplate) {
// 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": "functionomyprojectauthPreSignupArn"
};
}
resources.userPool.lambdaConfig = newLambdaConfig
// END - Lambda Triggers
} At this point what's missing is a resource policy for the Pre Signup Lambda. I put that in the custom stack, the resource looks like this: "UserPreSignupLambdaInvokePermission": {
"Type": "AWS::Lambda::Permission",
"Properties": {
"Action": "lambda:invokeFunction",
"FunctionName": {
"Ref": "functionmyprojectauthPreSignupName"
},
"Principal": "cognito-idp.amazonaws.com",
"SourceArn": {
"Ref": "authmyprojectUserPoolArn"
}
}
} You could optionally do that last step in the Lambda's CloudFormation file. |
Hey @kevinRR and @cespin 👋 thanks for raising this! As @chrisbonifacio mentioned this is a duplicate of #8997 and we'll close in favor of tracking the existing item. Please subscribe to the existing issue for further updates. 🙂 As a side note, love to see how the overrides were used as a workaround! |
Hey @cespin, I tried your solution, but it is not working for me.
And my
What I have also tried:
|
Hi @hackrx , Are those stack params ? Check the effective CloudFormation file that's being generated by Amplify and the available stack parameters. If the parameter is available you should then be able to Ref it. In my case all the lambda triggers were already there as params so I didn't have to add them. If you need to add params you can leverage Amplify env vars option or you can declare a stack dependency. I declare stack dependencies by manually modifying the team-provider-info.json file and then doing a amplify env checkout NAME command. All dependencies will be available as stack parameters. |
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:
JavaScript Framework
React
Amplify APIs
Not applicable
Amplify Categories
hosting
Environment information
Describe the bug
If I set the Lamda function trigger its change to none after every deployment
Expected behavior
should not change the Lamda function to none by default
Reproduction steps
Code Snippet
// Put your code below this line.
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: