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:
- https://github.com/serverless/serverless/issues/6579
- https://github.com/serverless/serverless/issues/7711
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,
Antony
Environment:
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
serverless.yaml
service: cognito-trigger-service
provider:
name: aws
runtime: nodejs12.x
stage: ${opt:stage, 'latest'}
region: ${self:custom.config.deployment.region}
profile: ${self:custom.config.deployment.profile}
environment:
STAGE: ${self:provider.stage}
iamRoleStatements:
- Effect: 'Allow'
Action:
- 'events:PutEvents'
Resource: "*"
functions:
cognitoMessageCustomisations:
handler: src/cognitoTriggerHandlers.messageCustomisations
events:
- cognitoUserPool:
pool: xxxxxxx-xxx #(the actual name of the User Pool, not id or arn)
trigger: CustomMessage
existing: true
custom:
config: ${file(../config.${self:provider.stage}.json)}