Email does not work after deployment
I have tried Mailgun, Sendgrid, and SMTP (from Sendgrid). All of these options send email just fine on my local machine. Once I deploy to Fly.io, no emails get sent.
I have ensured all server environment variables are set through Fly.io secrets. I have verified they are there. I have re-deployed many times after setting the secrets. Nothing seems to have any effect whatsoever.
I get no errors from the client side, and no network errors.
What am I missing?
6 Replies
Hi @Ryan Salsman. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I understand your frustration with email functionality not working after deployment to Fly.io. Let me help troubleshoot this issue.
Based on the information provided, here are some potential solutions:
Check Server Logs
First, check your server logs on Fly.io. The issue might not be visible from the client side, but the server logs could reveal what's happening when email sending is attempted. Look for any error messages related to your email provider.
SendGrid Specific Issue
SendGrid may be rejecting requests from your deployed environment. As mentioned by a community member, "Sendgrid always requires a url (not localhost) and does not accept API calls from my dev environment" Discord support thread. This could be happening with your deployed app if SendGrid is detecting something about your Fly.io environment that it doesn't like.
Environment Variables
While you've verified that your secrets are set in Fly.io, double-check that they're being correctly accessed by your application. Make sure the variable names match exactly what your code is expecting.
For SendGrid, ensure you have:
For Mailgun:
For SMTP:
Redeployment Solution
Sometimes simply redeploying can fix issues. One community member mentioned: "I just redeployed the app and it is working properly now" Discord support thread.
Certificate Issues
If your domain has certificate issues, this could affect services like email providers that validate your domain. One user solved a similar issue by:
1. Removing the old certificate
2. Creating a new certificate
3. Adding proper DNS records
4. Watching progress
Discord support thread
Try Different Provider
Since you've already tried multiple providers, this might not be the solution, but sometimes one provider works better than others in certain deployment environments.
If none of these solutions work, you might need to provide more specific error logs from your server to diagnose the exact issue. The problem is likely happening at the server level rather than the client side.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Ryan Salsman, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?
I thought it might have to do with a mismatch in my client url and server url, and also a mismatch with my server url and my REACT_APP_API_URL? The server wasn't matching what SendGrid expected? Or some mess in the chain. I made them all the same and it's still not working.
I'm going to check certs next.
Hello again @Ryan Salsman, let's discuss the problem here.
Do Wasp logs output anything useful? Does Wasp know that the sending failed or does it think it was successful?
Where would I check the Wasp logs?
There are two areas on fly.io where it seems logs are accessible: "Live Logs" and "Log Search".
When I click "Live Logs" it always says "Waiting for logs..." and both machines seem to be not running (they have grey dots).
When I click "Log Search" it says there is no data.
When I inspect network traffic, I'm getting http 200 responses on api endpoints, so it seems it's connecting to a server somehow.
I'll admit, I'm ignorant of this sort of stack so I'm not sure if I'm missing something "obvious."
When I run "fly logs -a sobek-server" I can see this in there...
LEMONSQUEEZY_API_KEY
I've added those secrets and then redeployed the server and I'm still getting that error. I'll keep hammering away.
Hm, gotta say you caught me there. I'll summon @miho to help. He knows Fly much better than I do
Could you copy paste the logs where you see
LEMONSQUEEZY_API_KEY
?