-
Notifications
You must be signed in to change notification settings - Fork 316
Description
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
The Mailpit SMTP server included in Supabase's local development stack experiences an ~8 second delay on every email send operation on certain systems due to reverse DNS lookup timeouts. This makes the local development environment extremely slow for any application that sends emails, and completely breaks automated tests that involve email sending.
To Reproduce
Note: This issue does not reproduce on all systems. It appears to be related to Docker's internal DNS resolver and container naming conventions that can cause reverse DNS lookups to fail with "bad rdata" errors, leading to 10-second timeouts.
Steps to reproduce (on affected systems):
- Start Supabase local development:
supabase start- Send an email via the local SMTP server (Mailpit) on port 54325:
telnet localhost 54325On affected systems, it takes approximately 8-10 seconds to receive the SMTP greeting: 220 <container-id> Mailpit ESMTP Service ready
- In an application, send any email through Nodemailer or similar SMTP client:
await transporter.sendMail({
from: 'test@example.com',
to: 'user@example.com',
subject: 'Test',
html: '<p>Test</p>'
});On affected systems, the operation takes ~8-10 seconds consistently.
- Check Docker logs for DNS errors:
sudo journalctl -u docker | grep "bad rdata"On affected systems, you may see errors like:
dockerd[1528]: level=error msg="[resolver] failed to write response" error="dns: bad rdata"
Expected behavior
SMTP connections and email sending should complete in under 100ms in the local development environment, as they do in production or when using other local SMTP servers.
Root Cause
This is a known issue with Mailpit documented here: axllent/mailpit#230
Mailpit performs reverse DNS lookups on connecting clients by default. On some systems (particularly certain Linux configurations), Docker's internal DNS resolver fails when looking up container names that become too long, returning "bad rdata" errors. This causes the reverse DNS lookup to timeout after 10 seconds before falling back to "unknown" as the hostname.
The Mailpit maintainer recommends disabling reverse DNS lookups for local development environments as a solution.
Proposed Solution
Add the following environment variable or flag to the Mailpit container configuration in Supabase's Docker setup:
Environment Variable:
MP_SMTP_DISABLE_RDNS=trueOr CLI flag:
--smtp-disable-rdns
This should be added to the Mailpit/Inbucket container definition in the Supabase CLI's Docker Compose templates.
Benefits:
- Fixes the timeout issue on affected systems
- Has no negative impact on systems not experiencing the issue
- Reverse DNS lookups serve no purpose in local development environments
- Improves email sending performance universally (even on unaffected systems)
System information
- OS: Ubuntu 24.04.3 LTS
- Supabase CLI version: 2.54.11
- Node.js version: v24.11.0
- Test framework affected: Playwright (and any automated testing that sends emails)
- Docker version: [output of
docker --version]
Additional context
This issue severely impacts local development and testing workflows on affected systems:
- Every email sent during Playwright tests adds 8-10 seconds of execution time
- Local development email flows feel broken/unresponsive
- The issue occurs consistently on every email send
- The problem is environmental/configuration-specific and may not reproduce on all developer machines
The fix is simple (adding one flag) and has no negative side effects for local development. Since this is a "defensive" fix that prevents issues on certain systems while not impacting others, it should be enabled by default in Supabase's local development stack.
Workaround Attempted
Connection pooling can mitigate this to some extent (subsequent emails on the same connection avoid the reverse DNS lookup), but the initial connection delay still breaks tests and impacts UX. The proper fix is to disable reverse DNS lookups entirely for the local development Mailpit instance.