serverless: AWS Events - PreSignUpCustomCognitoUserPool1 - Failed to create resource.

when deploying my sls project, i am having an error that prevents me from deploying:

ServerlessError: An error occurred: PreSignUpCustomCognitoUserPool1 - Failed to create resource. Cannot read property 'Id' of null See details in CloudWatch Log: 2020/05/10/[$LATEST]026a573177ec4f98878
74ab1cc9a66e4.
serverless.yml
service: test
custom:
  userPoolName: cover-${self:provider.stage}
provider:
  name: aws
  runtime: nodejs12.x
  region: eu-west-1
  stage: ${opt:stage, 'dev'} 
functions:
  preSignUp:
     handler: confirm.preSignUp
     events:
     - cognitoUserPool:
        pool: CoverUserPool
        trigger: PreSignUp
        existing: true  
resources:
  Resources:
    CognitoUserPoolCoverUserPool:
      Type: AWS::Cognito::UserPool
      Properties:
        MfaConfiguration: OFF
        UserPoolName: ${self:custom.userPoolName}
        UsernameAttributes:
        - email
        AutoVerifiedAttributes:
        - email
        Policies:
          PasswordPolicy:
            MinimumLength: 6
            RequireLowercase: False
            RequireNumbers: True
            RequireSymbols: False
            RequireUppercase: False
        Schema:
        - AttributeDataType: String
          Mutable: true
          Name: role
          Required: false
          DeveloperOnlyAttribute: true
        - AttributeDataType: String
          Mutable: true
          Name: providerId
          Required: false
          DeveloperOnlyAttribute: true
deploy output
sls deploy --stage prod

Installed version

??/??>sls -v
Framework Core: 1.66.0
Plugin: 3.4.1
SDK: 2.3.0
Components: 2.22.3

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

@medikoo I got the same issue with the latest framework version 2.54.0, using:

signup-trigger:
    handler: functions/cognito-to-dynamodb.handler
    events:
    - cognitoUserPool:
          pool: ${self:custom.GlobalTable.name}
          trigger: PostConfirmation
          existing: true

Without any better communicated warning. An error occurred: SignupDashtriggerCustomCognitoUserPool1 - Received response status [FAILED] from custom resource. Message returned: Cannot read property 'Id' of null See details in CloudWatch Log: 2021/08/16/[$LATEST]79066eb1e1e84571b30f2c8217de0e15 (RequestId: 3da801b4-8c35-49bd-9560-e0a34813a628).

I don’t feel this thread explains what the issue actually was…

I have the same error:

    Operating System:          darwin
    Node Version:              14.2.0
    Framework Version:         1.70.1
    Plugin Version:            3.6.11
    SDK Version:               2.3.0
    Components Version:        2.30.10

An error occurred: PostConfirmationCustomCognitoUserPool1 - Failed to create resource. Cannot read property 'Id' of null See details in CloudWatch Log

Edit:

  postConfirmation:
    handler: lambda/trigger/postConfirmation.main
    events:
      - cognitoUserPool:
          pool: ${cf:***-customer-base-${opt:stage, self:provider.stage}.CustomerUserPoolId}
          trigger: PostConfirmation
          existing: true

I fixed it with a little workaround: istead of :

preSignUp:
     handler: confirm.preSignUp
     events:
     - cognitoUserPool:
        pool: **CoverUserPool**
        trigger: PreSignUp
        existing: true

i tried:

preSignUp:
    handler: confirm.preSignUp
    events:
    - cognitoUserPool:
        pool:  **${self:custom.userPoolName}**
        trigger: PreSignUp
        existing: true

for some reason it stoped working like the first example… it may should be fixed

as in #6579 i use the pool name and it works