Open sharmmoh1983 opened 3 years ago
Please clarify the difference, the first message is json log message that is composed of logger details (level, date time, nodeid), metadata and log message that contains event. By the look both: cognito event and content of the message looks the same,
Please note that event listener normalised events into Records[] array. This means the few events that are single objects will be put into Records[] array by event listener.
The difference is that I can't use the default event message of AWS lambda to test the Cognito node as i always get following error : Request cannot be processed by event listener and it creates confusion This is the event I am testing locally but xpath which is I am using in my flow is payload.Records[0]
{
"version": "1",
"region": "xyz",
"userPoolId": "xyz",
"userName": "xyz",
"callerContext": {
"awsSdkVersion": "aws-sdk-unknown-unknown",
"clientId": "xyz"
},
"triggerSource": "PreSignUp_SignUp",
"request": {
"userAttributes": {
"name": "xyz",
"phone_number": "xyz"
},
"validationData": null
},
"response": {
"autoConfirmUser": false,
"autoVerifyEmail": false,
"autoVerifyPhone": false
}
}
This leads to confusion that without having Records field in test data still my flow is working.
We should have common Event message to test flows which is not case now
Event Listener has specific config details for Cognito originated event. You can specify what kind of trigger your flow expects, in this case it will be Pre-SignUp SignUp.
Event Listener will always normalise request into array of Records, the array will contain single record so you can access it: Records[0].
To test it, please use TestNode with exact event payload as specified by AWS, do not use HttpTestNode. I suspect the payload above has the correct structure of PreSignUp SignUp event.
There is a mismatch of Event payload used by AWS lambda and Cognito Trigger Listener in Kumologica flow
For ex: Event message for AWS lambda Pre Sign up
Event message for Cognito Listener Pre Sign up : It is a subset of AWS Lambda Event Payload
This gap causes confusion in testing nodes locally as my code using xpath based on AWS Lambda event but I am testing using different Event payload.
It would be easy to comprehend if Test nodes give consistent payload to test