My pre-signup-trigger lambda fails with the InvalidLambdaResponseException. Using nodejs. The user registration works without the trigger.
I tried pretty much all solutions suggested on SO how to handle this trigger. I have tried ending the lambda with context.done(null, event) and callback(null, event). The test script works. Worth mentioning that I have around 10 user attributes including 7 custom.
exports.handler = (event, context, callback) => {
// Check if business phone exists
event.response.autoConfirmEmail = false;
// This example uses a custom attribute "custom:domain"
if (event.request.userAttributes.hasOwnProperty("custom:business_phone")) {
if ( event.request.userAttributes["custom:business_phone"] !== null
&& event.request.userAttributes["custom:business_phone"] !== "") {
event.response.autoConfirmEmail = true;
}
}
// Return to Amazon Cognito
callback(null, event);
//context.done(null, event);
};
Test event works but user signup in browser returns InvalidLambdaResponseException. Tried one or both of the last two lines.
UPDATE: Getting same exception for Post confirm trigger. used aws doc example as is. Using runtime NodeJs 10.x. Tried 8.10 too.
To all he experts out there, please help!