Skip to content

fix: Server crash on unhandled rejection when an email adapter fails to send#10545

Open
dblythy wants to merge 1 commit into
parse-community:alphafrom
dblythy:fix/email-adapter-unhandled-rejection
Open

fix: Server crash on unhandled rejection when an email adapter fails to send#10545
dblythy wants to merge 1 commit into
parse-community:alphafrom
dblythy:fix/email-adapter-unhandled-rejection

Conversation

@dblythy

@dblythy dblythy commented Jul 5, 2026

Copy link
Copy Markdown
Member

Closes #8496

Also noting: the method-level fire-and-forget callers (RestWrite.js, UsersRouter.js, and resendVerificationEmail) could still surface a rejection from a pre-send step like getUserIfNeeded. That's a separate pre-existing pattern so i've kept this PR scoped to the email-send crash the issue actually reports - happy to do a follow-up for the broader pattern if we want.

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of verification and password-reset email delivery.
    • Email delivery failures are now logged clearly without crashing the application.
    • Prevented unhandled errors when email services reject requests or encounter configuration issues.

@parse-github-assistant

Copy link
Copy Markdown

🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review.

Tip

  • Keep pull requests small. Large PRs will be rejected. Break complex features into smaller, incremental PRs.
  • Use Test Driven Development. Write failing tests before implementing functionality. Ensure tests pass.
  • Group code into logical blocks. Add a short comment before each block to explain its purpose.
  • We offer conceptual guidance. Coding is up to you. PRs must be merge-ready for human review.
  • Our review focuses on concept, not quality. PRs with code issues will be rejected. Use an AI agent.
  • Human review time is precious. Avoid review ping-pong. Inspect and test your AI-generated code.

Note

Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect.

Caution

Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

UserController now catches rejected verification and password-reset email promises, logs flow-specific errors, and avoids unhandled failures. New specs verify both rejection paths.

Changes

Email rejection handling

Layer / File(s) Summary
Email dispatch error logging
src/Controllers/UserController.js
Verification and password-reset email dispatch use detached promise chains that catch failures and call logger.error with flow-specific messages.
Email rejection coverage
spec/UserController.spec.js
Tests configure rejecting email adapters and verify the corresponding errors are logged without crashing.

Estimated code review effort: 2 (Simple) | ~10 minutes


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Description check ❌ Error The description is far too sparse and omits the required Issue, Approach, and Tasks sections from the template. Add the Issue, Approach, and Tasks sections, including the linked issue and a brief summary of the implementation and test work.
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the PR scope and uses the required 'fix:' prefix.
Linked Issues check ✅ Passed The code and tests address #8496 by catching rejected email-send promises and logging failures instead of crashing.
Out of Scope Changes check ✅ Passed The changes stay focused on email-send rejection handling and its tests, with no obvious unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Security Check ✅ Passed Only async email-send error handling changed; no new sinks, input processing, or common advisory-class vulnerability patterns were introduced.
Engage In Review Feedback ✅ Passed No actionable review feedback is documented; the only noted comment requested a full review, so this check is vacuously satisfied.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.66%. Comparing base (cce91e5) to head (7bf12a1).
⚠️ Report is 52 commits behind head on alpha.

Additional details and impacted files
@@           Coverage Diff           @@
##            alpha   #10545   +/-   ##
=======================================
  Coverage   92.66%   92.66%           
=======================================
  Files         193      193           
  Lines       16981    16982    +1     
  Branches      248      248           
=======================================
+ Hits        15736    15737    +1     
  Misses       1224     1224           
  Partials       21       21           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dblythy

dblythy commented Jul 26, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node crashes when promise rejection occurs in apiCallback

1 participant