Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions nodejs/src/cdp/services/messaging/email.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,10 @@ describe('EmailService', () => {
expect(result.error).toBeUndefined()
expect(result.metrics.map((m) => m.metric_name)).toEqual(['email_missing_recipient'])
expect(result.skipped).toBe(true)
expect(result.emailSendResult).toEqual({
status: 'skipped',
reason: expect.stringContaining('the recipient has no email address'),
})
expect(invocation.state.vmState?.stack).toEqual([{ success: false }])
})

Expand Down
6 changes: 3 additions & 3 deletions nodejs/src/cdp/services/messaging/email.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,10 @@ export class EmailService {
// so record a skip with its own metric instead of an `email_failed`. Otherwise one project
// with bad data inflates the platform send failure rate.
if (!params.to?.email?.trim()) {
addLog(
'warn',
const skipReason =
'Skipping send: the recipient has no email address. Add a filter so only people with an email address reach this step.'
)
addLog('warn', skipReason)
result.emailSendResult = { status: 'skipped', reason: skipReason }
if (!isTest) {
result.metrics.push({
team_id: invocation.teamId,
Expand Down
Loading