amplify-cli: Weird content of confirmation email triggered by Custom message Lambda trigger after creating new environment
Before opening, please confirm:
- I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- I have searched for duplicate or closed issues.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- I have removed any sensitive information from my code snippets and submission.
How did you install the Amplify CLI?
yarn
If applicable, what version of Node.js are you using?
No response
Amplify CLI Version
7.6.15
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.
No manual changes
Amplify Categories
auth, custom, storage, function, api
Amplify Commands
push
Describe the bug
The content of the email that should come with verification link is mixed.
By mixed I mean that sometimes the body of the email that is set in the lambda trigger is actually replaced by the default body that can be seen in the ‘message templates’ (verification message) in Messaging tab of user pool console, but the subject of the email is correct (set in lambda).
Other times the subject and the body of the email that should be set in lambda are replaced with the default ones. Probably because the variables that should contain appropriate strings (emailSubject, emailMessage) are empty - looks like the settings in function-parameters.json is ignored in this case.
At some point I was able to fix it, but to be honest I don’t remember how, it suddenly started to work after several amplify update auth + amplify push --force… but few updates later (amplify push, deployment in amplify console and upgrade of amplify) broke this trigger. There are no errors in the cloudwatch…
Expected behavior
Verification email contains a correct subject and the body set in custom message lambda trigger and settings in function-parameters.json are respected.
Reproduction steps
- Deploy app by CI/CD (amplify console)
- Create a user (in the app) triggers the email with default subject and body (those set in lambda are emptied): https://d.pr/i/Ke6yfL
- Update the code of the lambda trigger by adding a simple console.log
- Push updates via
amplify push - create another user triggers the email with this content: https://d.pr/i/nMMs94
- Another deployment via CI/CD
- create another user triggers the email with such content: https://d.pr/i/ifRNpE
GraphQL schema(s)
# Put schemas below this line
Log output
# Put your logs below this line
Additional information
No response
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 16 (7 by maintainers)
Ah thank you for clarifying @jk171505 I was able to reproduce this issue when creating a new environment. We see in our
team-provider-info.jsonthese values are not populated like they are for the env we initially used to add the triggerAnd despite these values being available in
function-parameters.json, the function does not have the env vars populated after pushing, which explains the default messagingMarking as a bug 🙂