What kind of event does Cognito send from Pre Sign-up Lambda Trigger

I have created a PreSignup Lambda function to be used with Cognito Pre-SignUp trigger with the following code:

import { APIGatewayEventDefaultAuthorizerContext, APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda';

export async function PreSignup(event: any, context: APIGatewayEventDefaultAuthorizerContext,) {
  console.log("...event:", event);
  console.log("...context:", context);

  let userName = event.userName;
  let email = event.request.userAttributes.email;

  console.log("...userName:", userName);
  console.log("...email:", email);

  // Confirming the event so Cogntio doesnt resend it again:
  event.response.autoConfirmUser = true;
  event.response.autoVerifyPhone = true;
  event.response.autoVerifyEmail = true;
  return event;

Instead of setting up the event to any with function PreSignup(event: any) I would rather specify a type of the event.

I tried to specify it as APIGatewayProxyEvent like so:

function PreSignup(event: APIGatewayProxyEvent, context: APIGatewayEventDefaultAuthorizerContext,) {...}

but it doesn’t work as the event sent by Cognito Pre Sign-Up trigger is not a APIGatewayProxyEvent type. What kind of event is it?

Edited later:

Below is copy/pasted event that was pushed by Cognito PreSignUp Trigger:

  version: '1',
  region: 'us-east-1',
  userPoolId: 'us-east-1_abcdef',
  userName: 'emailf@address.com',
  callerContext: {
    awsSdkVersion: 'aws-sdk-nodejs-2.799.0',
  triggerSource: 'PreSignUp_AdminCreateUser',
  request: {
    userAttributes: { email: 'emailf@address.com' },
    validationData: null
  response: {
    autoConfirmUser: false,
    autoVerifyEmail: false,
    autoVerifyPhone: false

Below is an example of another AWS event this time pushed by AWS EventBridge (similar to the one pushed by Cognito Trigger):

  version: '0',
  id: '0ee136cb-ea53-f9e0-a6a9-232dfb78b7d0',
  'detail-type': 'UserCreated',
  source: 'my.company.endpointname',
  account: '123456789012',
  time: '2021-01-29T03:05:54Z',
  region: 'us-east-1',
  resources: [],
  detail: { foo: 'bar', createdAt: 1611889553709 }

80 thoughts on “What kind of event does Cognito send from Pre Sign-up Lambda Trigger”

  1. Hello,

    I’m looking for website owners who are willing to partner with us in the dating and professional escorts niche/industry.
    We’d like to offer payments in exchange for articles published on javascript-help.li. We can either send you well-written content that’s ready to post, or you can write it yourself.

    Of course, an even simpler solution would be to simply place a link inside one of your pages, for a fee, of course.

    We understand that our website is in a sensitive niche, so for your peace of mind and ours as well, we would be OK with you placing a link inside an older article, to keep it away from your day-to-day traffic.

    We already work with thousands of other sites, both businesses and individual blog owners.

    Would you be interested?

    Jim Murray
    Blogger Outreach Specialist


    Estoy buscando propietarios de sitios web que estén dispuestos a asociarse con nosotros en el nicho / industria de citas y acompañantes profesionales.
    Nos gustaría ofrecer pagos a cambio de artículos publicados en javascript-help.li . Podemos enviarle contenido bien escrito que esté listo para publicar, o puede escribirlo usted mismo.

    Por supuesto, una solución aún más simple sería simplemente colocar un enlace dentro de una de sus páginas, por una tarifa, por supuesto.

    Entendemos que nuestro sitio web se encuentra en un nicho sensible, por lo que, para su tranquilidad y la nuestra también, estaríamos de acuerdo con que colocara un enlace dentro de un artículo anterior, para mantenerlo alejado de su tráfico diario.

    Ya trabajamos con miles de otros sitios, tanto empresas como propietarios de blogs individuales.

    ¿Estarías interesado?

    Jim Murray
    Especialisto en publicidad de blogueros