Existing Cognito Pool as function trigger

Hi there,

I’m having trouble deploying one of my Serverless functions that needs to use an existing Cognito User Pool as a trigger. However it fails each time with an error like ServerlessError: An error occurred: CognitoMessageCustomisationsCustomCognitoUserPool1 - Failed to create resource. Cannot read property 'Id' of null See details

I have read numerous posts, including:

and just don’t seem to be able to get it working.

Some have advised deleting and recreating my UserPool. While I could do this on my dev env, I can’t do that in production.

I’ve tried changing the pool attribute to use the ARN and the ID, and also tried changing the attribute name to poolId, all to no avail.

Not quite sure where to take this next. Any advice appreciated.

Thanks so much,


     Operating System:            darwin
     Node Version:                   12.13.0
     Framework Version:          1.82.0
     Plugin Version:                  3.8.3
     SDK Version:                     2.3.1
     Components Version:        2.34.9


service: cognito-trigger-service

  name: aws
  runtime: nodejs12.x
  stage: ${opt:stage, 'latest'}
  region: ${self:custom.config.deployment.region}
  profile: ${self:custom.config.deployment.profile}
    STAGE: ${self:provider.stage}
    - Effect: 'Allow'
        - 'events:PutEvents'
      Resource: "*"

    handler: src/cognitoTriggerHandlers.messageCustomisations
      - cognitoUserPool:
          pool: xxxxxxx-xxx #(the actual name of the User Pool, not id or arn)
          trigger: CustomMessage
          existing: true

  config: ${file(../config.${self:provider.stage}.json)}

Sorry all… it looks like the reason it wasn’t working was due to cognito being in a different region in my AWS development account.
A more helpful message would be really nice here