-
Notifications
You must be signed in to change notification settings - Fork 823
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
Custom Message Trigger set in override.ts not applying #13083
Comments
Hey @ChadyG 👋 thanks for raising this! I believe the issue here stems from the fact that the auth triggers are defined in a separate stack, where there is a custom resource setting the triggers directly on Cognito. Despite this, you can set a custom message Lambda through the CLI in the |
Thank you @josefaidt! I was able to set up the custom message with redirect via the CLI. However, we don't need the redirect functionality. I'm also unsure if we can swap the existing function to one created by the Amplify CLI as there is another team and project which we share the Cognito resource with and the custom message lambda is from that team. So I was hoping the override would be the right way to ensure that configuration isn't lost whenever we need to push changes to the auth stack. |
Hey @ChadyG thanks for clarifying! There should be an option to generate a "custom module" after enabling the "custom message" Cognito trigger, which will attach it to your auth resource and enable you to write your own custom logic. Additionally, you can modify the Function's CloudFormation template directly to suit your needs |
Hello @josefaidt, sorry for the delayed response. When I tried your suggested workaround, I may have gotten confused on where the CloudFormation template code is. I saw the template configuration and parameters, but these assume we are using Amplify styled function names with the environment suffixed on. Unfortunately we currently have the functions named differently (and they only exist in two environments). Is there a cleaner alternative other than pulling these functions into the Amplify project/configuration directly? |
Hey @ChadyG apologies for the delay here! You can use a post-push command hook and the AWS SDK to manually set the triggers defined outside the project on your auth resource, however unfortunately we do not currently support importing Functions |
Thanks @josefaidt! That makes perfect sense as a solution. |
Closing the issue, please feel free in reaching out us if you require any assistance. |
|
How did you install the Amplify CLI?
homebrew
If applicable, what version of Node.js are you using?
v20.3.0
Amplify CLI Version
12.1.1, 12.2.3
What operating system are you using?
Mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
Existing Custom Message Lambda and trigger.
Describe the bug
I'm attempting to configure our custom message lambda and trigger from the auth override.ts, however it is not applying. Tried in our dev and test cognito backends with no luck, having the custom message set before deploy and without, and removing other overrides. I can confirm that the override is being parsed since I'm getting warnings when incorrectly setting the customMessage parameter.
See override.ts code below.
Expected behavior
Setting UserPool LambdaConfig CustomMessage to a lambda ARN should set the custom mesage trigger in Cognito.
Reproduction steps
Project Identifier
No response
Log output
Additional information
Before submitting, please confirm:
The text was updated successfully, but these errors were encountered: