Skip to content

Instantly share code, notes, and snippets.

@charltoons
Created August 26, 2017 14:21
Show Gist options
  • Save charltoons/9f13f7c4993420ca23013ee33a3a4619 to your computer and use it in GitHub Desktop.
Save charltoons/9f13f7c4993420ca23013ee33a3a4619 to your computer and use it in GitHub Desktop.
AWS Cognito Lambda PreSignup Auto-Confirm Trigger
'use strict';
exports.handler = (event, context, callback) => {
console.log('Received event:', JSON.stringify(event, null, 2))
const modifiedEvent = event
// check that we're acting on the right trigger
if (event.triggerSource === "PreSignUp_SignUp"){
// auto confirm the user
modifiedEvent.response.autoConfirmUser = true
callback(null, modifiedEvent)
return
}
// Throw an error if invoked from the wrong trigger
callback(`Misconfigured Cognito Trigger ${ event.triggerSource }`)
};
@tcchau
Copy link

tcchau commented Jul 31, 2019

@mattysads this little trick will suppress linter errors that tell you not to modify function arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment