Fix Cloudflare email sending endpoint - #144
Conversation
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe PR updates the Cloudflare email API integration by migrating the endpoint from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.
Reviewed by Cursor Bugbot for commit b80269d. Configure here.
| ): Promise<CloudflareSendResult> { | ||
| const endpoint = new URL( | ||
| `client/v4/accounts/${config.accountId}/email-service/send`, | ||
| `client/v4/accounts/${config.accountId}/email/sending/send`, |
There was a problem hiding this comment.
Vestigial messageId extraction yields perpetually undefined id
Low Severity
After switching to the /email/sending/send endpoint, the API response no longer includes a messageId field — it returns delivered, permanent_bounces, and queued instead. Yet sendViaCloudflareApi still attempts to extract payload.result.messageId and expose it as id on CloudflareSendResult. This means id is now always undefined, making both the extraction logic (lines 125–128) and the messageId field on CloudflareApiEnvelope dead code. A future developer seeing id?: string on the return type might rely on it, not realizing it's never populated.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit b80269d. Configure here.


Summary
/email/sending/sendendpointTesting
npx vitest run packages/worker/src/app/email/cloudflare-email.node.test.tsnpx nx run worker:typechecknpx oxlint packages/worker/src/app/email/cloudflare-email.ts packages/worker/src/app/email/cloudflare-email.node.test.ts packages/mock-servers/cloudflare/src/worker.tsnpx oxfmt --check packages/worker/src/app/email/cloudflare-email.ts packages/worker/src/app/email/cloudflare-email.node.test.ts packages/mock-servers/cloudflare/src/worker.tsSummary by CodeRabbit
Bug Fixes
Tests