If a schedule in PagerDuty contains inactive users, then the lambda will crash with a Key error trying to get data from the user that is not there.
This catches that explicit error and shows the user as deactivated, using the Summary field, which is present, to show their name.
To test it I've ran the lambda with a placeholder pagerduty schedule and user, and then deleted the user, running the lambda between each step to ensure it worked with a valid user and with an inactive user.
If a schedule in PagerDuty contains inactive users, then the lambda will crash with a Key error trying to get data from the user that is not there.
This catches that explicit error and shows the user as deactivated, using the Summary field, which is present, to show their name.
To test it I've ran the lambda with a placeholder pagerduty schedule and user, and then deleted the user, running the lambda between each step to ensure it worked with a valid user and with an inactive user.