Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

235
Views
Which is the correct format for Lambda AWS PreSignUp Response

I'm working on a VUE+Amplify project, it's almost done, but cognito does not offer mail duplication check, so i've to do it manually, as we know AWS has some triggers i'm using PreSignUp invoking a Lambda function, my code is:

var AWS = require("aws-sdk");
const cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();


exports.handler =  function(event, context, callback) {
  var params = {
    UserPoolId: "us-east-1_xxxXXXxXX",
    AttributesToGet: ["email"]
  };

  cognitoidentityserviceprovider.listUsers(params, (err, data) => {
    if (err) {
      console.log(err, err.stack);
      callback(err)        // here is the error return
    } else {
      data.Users.forEach(function(usuario) {
        if(usuario.Attributes[0].Value == event.request.userAttributes.email){
          return {};
        }
      });
      callback(event);
    }
  });
}

but I dont understand what I am doing wrong, the lambda execution returns...

Object { code: "UserLambdaValidationException", name: "UserLambdaValidationException", message: "PreSignUp failed with error [object Object]." }

Any idea?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to return the event object

https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-pre-sign-up.html

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!