-
Notifications
You must be signed in to change notification settings - Fork 1
Troubleshooting
This page covers the most common issues encountered when setting up, deploying, and running Mailbox.
The setup wizard is only accessible when no Owner account exists. If the page redirects or shows this message, an Owner was already created. Go directly to /login instead.
If you need to start fresh for development purposes, wipe your database:
rm dev.db # SQLite
npm run db:push # Recreate schemaYour DATABASE_URL is missing, incorrect, or pointing to a database that isn't running.
Checklist:
- Confirm
DATABASE_URLis set in your.env. - For Docker databases, verify containers are running:
npm run docker:up. - For Neon/Supabase, check the connection string is the pooled version (not the direct connection string).
Run the schema sync commands:
npm run db:generate
npm run db:push # For SQLite / serverless
npm run db:migrate # For PostgreSQL / MySQL via DockerServerless databases use a transaction pooler proxy that blocks Prisma migration lock tables. Use db:push instead:
npm run db:pushWork through this checklist in order:
- Is Email Routing enabled? Go to Cloudflare Dashboard → your domain → Email → Email Routing. It must show "Enabled".
- Is the domain linked in Mailbox? Go to Settings → Cloudflare Integration. The domain should show as linked.
-
Is your app publicly accessible? The Cloudflare Worker needs to reach your webhook URL over the internet.
localhostwill not work. -
Is the Worker deployed? In Cloudflare Dashboard → Workers & Pages, look for a Worker named
mailbox-*. If it's missing, unlink and re-link the domain. -
Is
WEBHOOK_SECRETmatching? TheWEBHOOK_SECRETin your.envmust exactly match the one configured in the Cloudflare Worker's environment variables.
The x-webhook-secret header sent by the Worker does not match WEBHOOK_SECRET in your Next.js environment. Re-link the domain from Settings to re-sync the secret.
Your NEXT_PUBLIC_APP_URL is set incorrectly. It must be a valid HTTPS URL with no trailing slash (e.g. https://mail.yourcompany.com).
The Worker ran but your webhook returned an error. Check your Next.js server logs for the error from /api/emails. Common causes:
- No active mailbox address matching the recipient.
- Database is unreachable.
The background mail queue worker runs inside the Next.js server process. If the server restarts or the process crashes, the worker stops polling. Restarting the server will restart the worker.
On serverless platforms (Vercel), long-running background workers are not supported — consider using an external job queue or cron trigger for production sending.
One of two reasons:
-
SMTP_DRY_RUN=trueis set in your.env. Remove or set it tofalse. -
SMTP_HOSTorSMTP_USERis missing. The system falls back to console mode automatically when SMTP is not configured.
Your SMTP credentials are wrong or your provider is rejecting the connection. Check:
-
SMTP_HOST,SMTP_PORT,SMTP_USER,SMTP_PASSare all correct. -
SMTP_SECURE=truefor port 465,falsefor port 587. - Your SMTP provider allows the connection (some require app-specific passwords or whitelist IPs).
- Double-check for leading/trailing spaces in the email or password field.
- The account may be banned (
isBanned: true). Check the Users panel. - If you just ran
db:pushor reset the database, the account no longer exists — complete the setup wizard again.
WEBHOOK_SECRET (used for signing session tokens) may have changed between deploys. This invalidates all existing sessions. Users will need to log in again after a secret rotation — this is expected behaviour.
- Check your SMTP configuration — if it's not set up, the email is only printed to the console.
- Check your spam/junk folder.
- The reset link expires in 1 hour — request a new one if it has expired.
Invite tokens expire after 48 hours. Ask an Admin to delete and re-create the user account to generate a fresh invite.
The vercel-build script (prisma generate && prisma db push && next build) requires DATABASE_URL to be set as a Vercel environment variable. Add it in the Vercel project settings before deploying.
- Check the container logs:
npm run docker:logs - Verify your Nginx reverse proxy config is pointing to the correct port (default:
3000). - Ensure your SSL certificate (Certbot) is valid and not expired.
The Next.js app container is trying to connect to the database before it is ready. Wait ~10 seconds and check again — Docker Compose does not guarantee start order by health. If it persists, add a healthcheck to your docker-compose.yml.
If none of the above resolves your issue:
- Check the server logs for the full error stack trace.
- Open
npm run db:studioand inspect the database tables directly. - Open an issue on GitHub with your error message and steps to reproduce.