Skip to content

Fix/email login#81

Merged
mcheemaa merged 4 commits intoghostwright:mainfrom
suwyn:fix/email-login
Apr 17, 2026
Merged

Fix/email login#81
mcheemaa merged 4 commits intoghostwright:mainfrom
suwyn:fix/email-login

Conversation

@suwyn
Copy link
Copy Markdown
Contributor

@suwyn suwyn commented Apr 17, 2026

What Changed

Fixes the sender domain for email login that leads to resend rejecting the email when using a custom PHANTOM_DOMAIN

Why

When using a custom PHANTOM_DOMAIN I am unable to receive an email because it is rejected by Resend.

Expected Result:
When providing my email to the Phantom login, I receive an email with the magic link

Actual Result:
No email arrives. Resend logs show the these as 403 errors with the message Domain not verified: Verify ghostwright.dev or update your from domain. The sender is not using my configured PHANTOM_DOMAIN "from": "Phantom <phantom@ghostwright.dev>"

How I Tested

Ran the branch on my VM and received the email as expected.

Checklist

  • Tests pass (bun test)
  • Lint passes (bun run lint)
  • Typecheck passes (bun run typecheck)
  • No secrets or .env files included
  • Files stay under 300 lines
  • No Cardinal Rule violations (TypeScript does plumbing only, the Agent SDK does reasoning)
  • No default exports or barrel files added

suwyn and others added 3 commits April 17, 2026 07:14
- Thread config.domain through the call chain as an explicit parameter
  on both handleEmailLogin() and sendLoginEmail(), matching the pattern
  used by the email tool in src/index.ts (config.domain ?? "ghostwright.dev")
- Remove direct process.env.PHANTOM_DOMAIN read from sendLoginEmail so
  domain set via phantom.yaml is respected, not just the env var
- Destructure { error } from resend.emails.send() and throw on API errors;
  the SDK returns errors in the response rather than throwing, so the
  previous code silently logged success on send failures
- Add domain?: string to handleFirstRun config type to accept the field
…_EMAIL

- Add test: sendLoginEmail throws when Resend returns an API error response
- Add test: domain parameter is used for the sender domain (not env var)
- Update all call sites in tests to pass domain as explicit 4th argument
- Document OWNER_EMAIL in .env.example Email section
Copy link
Copy Markdown
Member

@mcheemaa mcheemaa left a comment

Choose a reason for hiding this comment

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

Clean fix, tight tests, nice catch on the Resend error response too. Thanks for the thorough write-up in the PR body. Approving. Looking forward to more from you.

@mcheemaa mcheemaa merged commit 3c2837d into ghostwright:main Apr 17, 2026
1 check passed
@suwyn suwyn deleted the fix/email-login branch April 18, 2026 02:29
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.

2 participants