SMTP doesn't send emails on production

Hi, I configured SMTP and testing on local, everything works great, I sign up and I get the verification email. Unfortunately, when I switch to production, emails aren't sending. The error: Failed to send email Error: connect ECONNREFUSED 127.0.0.1:587 WASP version: 0.14.0 My platform: WSL Server side: Heroku Client: Netlify My browser console has another error, but I wouldn't say that they're related: GET https://chatupr-bdc0cad70cd0.herokuapp.com/auth/me 401 (Unauthorized) If you need any additional info, let me know. Thank you!
3 Replies
kapa.ai
kapa.ai17h ago
Hi @flap27. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The error message Failed to send email Error: connect ECONNREFUSED 127.0.0.1:587 suggests that your application is unable to establish a connection to the SMTP server. This could be due to several reasons such as incorrect SMTP settings, network issues, or the SMTP server not running. Here are a few things you can check: 1. SMTP Settings: Ensure that your SMTP settings are correctly configured in your .env.server file. The settings should look something like this:
SMTP_HOST=
SMTP_USERNAME=
SMTP_PASSWORD=
SMTP_PORT=
SMTP_HOST=
SMTP_USERNAME=
SMTP_PASSWORD=
SMTP_PORT=
Replace the placeholders with your actual SMTP server details. Make sure that the SMTP_PORT is set to the correct port number for your SMTP server. The default port for SMTP is usually 587, but your provider might use a different one. 2. Environment Variables: Ensure that the environment variables are correctly set in your production environment. The environment variables in the .env.server file are used in the development environment. For the production environment, you need to set these variables in your hosting platform (Heroku). 3. Network Issues: The error could also be due to network issues. If your SMTP server is running on a different machine, ensure that the server is reachable from the machine where your application is running. 4. SMTP Server: Ensure that your SMTP server is running and listening on the correct port. As for the GET <https://chatupr-bdc0cad70cd0.herokuapp.com/auth/me> 401 (Unauthorized) error, it seems like an authentication issue. This error occurs when a request is made to a protected endpoint without providing a valid authentication token. Make sure that you're correctly setting the authentication headers for your requests. If you're still facing issues, I would recommend reaching out to the Wasp community on Discord (https://discord.com/channels/686873244791210014/1179895919471247490) or opening an issue on the Wasp Github page (https://github.com/wasp-lang/wasp/issues). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @flap27, 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?
flap27
flap2717h ago
The full error message from the heroku console: Failed to send email Error: connect ECONNREFUSED 127.0.0.1:587 at node_internal_captureLargerStackTrace (node:internal/errors:496:5) at node_internal_exceptionWithHostPort (node:internal/errors:671:12) at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) { errno: -111, code: 'ESOCKET', syscall: 'connect', address: '127.0.0.1', port: 587, command: 'CONN' }
miho
miho2h ago
Where is your SMTP server located at? 127.0.0.1:587 is a local IP address and it won't work - unless you are running a SMTP server on Heroku yourself locally? What is your SMTP server URL in .env.server for local development?
Want results from more Discord servers?
Add your server