Post Authentication Lambda is being triggered inconsistently

0

Hello,

I have set up a Cognito User Pool with 2 federated clients (Apple and Google). We have configured a Post Authentication lambda to send some tracking event to an external service, but we are seeing inconsistent results. The first time I log in using any of the federated clients I can confirm through CloudWatch that the lambda is triggered, and we see the correct tracking being done. Whenever we logout on our service and log back in again, we do not see this lambda being triggered through cloudwatch logs (also no tracking calls are made).

Why is it not being triggered again?

Kind regards

Ian
asked 2 months ago107 views
2 Answers
1

Hello, according to the documentation, the Post Authentication trigger should trigger in subsequent sign-ins for the federated users instead of the first time: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html#lambda-triggers-for-federated-users

Could you mind verify again using the correct trigger? Thanks.

Zen
answered 2 months ago
profile picture
EXPERT
reviewed 2 months ago
0

Hello, thanks for the reply, I've double checked the lambda setup and it is in fact a Post Authentication Lambda. We did some more research into this and whenever we login on a fresh incognito chrome browser, the event is being triggered. Whenever we open a fully fresh new incognito instace and log in again, it is also being triggered.

My expectation is that whenever a user clicks logout (and we call the <cognito-instance>/logout from our front end) the session is deemed closed, and whenever that same user logs in again, even in that same browsing session, the post authentication lambda is triggered again.

Kind Regards

Ian
answered a month ago