Make email configuration optional#69
Conversation
|
@keshav-005 is attempting to deploy a commit to the ravixalgorithm's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR makes Nodemailer/Gmail credentials optional: the app can start without Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant User
participant Inngest as Inngest Function
participant App as App/Server
participant Nodemailer as Nodemailer/SMTP
User->>App: POST /signup (create account)
App->>Inngest: trigger send-welcome-email step
Inngest->>Nodemailer: request sendWelcomeEmail
alt transporter exists
Nodemailer->>Nodemailer: send email via SMTP
Nodemailer-->>Inngest: { status: "sent", messageId }
Inngest-->>App: continue with "email sent" path
else transporter missing
Nodemailer-->>Inngest: { status: "skipped" }
Inngest-->>App: continue with "email skipped" path (logged)
end
App-->>User: respond with signup result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lib/nodemailer/index.ts`:
- Around line 34-38: The sendWelcomeEmail function currently throws when
transporter is null which causes callers to treat email as a failure; change it
to skip silently (or return a resolved value) when transporter is not configured
instead of throwing: in sendWelcomeEmail (and the similar function around lines
61-67) replace the throw new Error('Email credentials not configured') with an
early return/no-op (optionally logging a debug/info message) so the function
resolves successfully when transporter is null and only attempts to send when
transporter exists.
In `@README.md`:
- Around line 277-280: The README's .env example sets NODEMAILER_EMAIL and
NODEMAILER_PASSWORD to literal placeholders which makes hasEmailConfig evaluate
true and incorrectly trigger Gmail transporter initialization; update the .env
examples (including the block around NODEMAILER_EMAIL/NODEMAILER_PASSWORD and
the similar block at lines 318-321) to comment out or remove those optional
lines so they are not inadvertently set by copy-paste, and ensure the docs
explicitly show them commented/unset to preserve the “omitted credentials” path
used by the code that checks hasEmailConfig.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4e1869f6-fd84-46c5-9a79-cf7ae0183975
📒 Files selected for processing (2)
README.mdlib/nodemailer/index.ts
|
Thanks, updated. Missing email config now skips sends cleanly, and the optional .env examples are commented out so copy-paste preserves the disabled-email path. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lib/nodemailer/index.ts`:
- Around line 36-39: The callers of sendWelcomeEmail (the send-welcome-email
step in lib/inngest/functions.ts) are logging success unconditionally even when
lib/nodemailer/index.ts returns null because transporter is not configured;
update either sendWelcomeEmail to return a discriminated result (e.g., {
skipped: true } | { success: true, info: ... }) instead of null, or update the
caller(s) (send-welcome-email and the news-summary caller) to check the return
value from sendWelcomeEmail and only log "✅ Welcome email sent successfully"
when a success result is returned; reference the transporter check in
lib/nodemailer/index.ts and the sendWelcomeEmail invocation in
lib/inngest/functions.ts to locate the spots to change.
- Line 37: Replace the double-encoded mojibake sequence in the warning messages
with the proper warning emoji "⚠️" in the console.warn calls in this module
(both occurrences currently showing "âš ï¸�" — e.g., the console.warn that logs
"Welcome email skipped: email credentials are not configured." and the other
similar warning later in the file). Update both console.warn strings to include
"⚠️" exactly and save the file with UTF-8 encoding to prevent reintroducing the
encoding issue.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f1adfa07-74fb-4e1e-b871-da58f7d4b8f5
📒 Files selected for processing (2)
README.mdlib/nodemailer/index.ts
✅ Files skipped from review due to trivial changes (1)
- README.md
|
Thanks, updated. The mailer now returns an explicit skipped/sent result, and the signup flow only logs and reports success when a welcome email is actually sent. |
Summary
Test plan
Fixes #37
Summary by CodeRabbit
Documentation
Bug Fixes