Skip to content

Conversation

sandrotaje
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@tpetrucciani tpetrucciani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! (of course the other handlers must be updated)

Comment on lines +66 to +79
if (resp.length > 1) {
loggerInstance.error(
`Multiple users (${resp.length}) found in Selfcare for userId ${userId} and tenant ${tenantId}`
);
return undefined;
}

const email = resp[0].email;
if (!email) {
loggerInstance.error(
`User ${userId} in tenant ${tenantId} has no email in Selfcare`
);
return undefined;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I agree with the error handling choices

The only issue could be that, for the logger.error + discard cases, if they occur because of a Selfcare API change that affects all users, we could discard many notifications before we realize the error. However, if they occur for individual users (due to dirty data in the Selfcare source of truth), this approach is best to avoid stopping sending emails entirely. That seems to me the most likely case in which this occurs, so I think it makes sense to treat them as done here. In the less likely scenario of an uncommunicated API schema change, we could always reprocess the events to resend the discarded notifications

Copy link
Collaborator

@tpetrucciani tpetrucciani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 just one minor comment

@sandrotaje sandrotaje merged commit 905e79f into develop Oct 16, 2025
11 of 12 checks passed
@sandrotaje sandrotaje deleted the PIN-7887_get-user-from-selfacare-email-sender branch October 16, 2025 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants