-1

I'm sorry to ask for help on this but I'm so lost. I added a contact form to my express site and the app keeps crashing now on the live server. Error code H10. It runs fine in development. I've read the logs, attempted to change things and I just cannot figure out the source of the issue. Would anyone be willing to take a look for me? This repo is here: https://github.com/michaelacook/portfolio-site

Live demo: https://michaelcook-portfolio-site.herokuapp.com/

Any help would be greatly appreciated. I can only bang my head againt the desk for so long before I need someone else to take a look.

1 Answers1

0

The error was due to nodemailler config.

  • Of course. I've been having problems with nodemailer. The documentation says that when the callback if left out of the `sendMail` function a promise is returned, but this clearly isn't true. Am I missing something on this? Or should I log an issue if someone else haven't already – Michael Alexander May 02 '20 at 19:42
  • I am actually checking it on my machine locally. I will try to figure out the exact problem and will share the repo with you once i am done. –  May 02 '20 at 19:48
  • Thanks. I tried your fix and the site still crashes on the live server. Even more confused now. Your efforts to help are appreciated – Michael Alexander May 02 '20 at 19:49
  • This is the issue: https://stackoverflow.com/questions/48854066/missing-credentials-for-plain-nodemailer and this is the error message `(node:8585) UnhandledPromiseRejectionWarning: Error: Missing credentials for "PLAIN"`. Seems like you will have to configure nodemailer. –  May 02 '20 at 19:55
  • Okay, thanks. How did you find this out though? When I run the site in development I don't get any errors. – Michael Alexander May 02 '20 at 19:59
  • You were using try catch block to handle error's for sendEmail function but you were not logging the error so you can see on the console in dev mode. Each time you submit the form it actually throws the same error due to nodemailler fail. Nodemailler seems like a bit confusing. I use sendGrid which is simpler i guess. If you want i can share with you a snippet for sendGrid integration. –  May 02 '20 at 20:04
  • That would be very nice, thanks. I'm having endless issues trying to get nodemailer to work in production here. "Easy as cake" yeah right. – Michael Alexander May 02 '20 at 20:20
  • I already signed up for sendGrid and got an api key. You really went above and beyond to help me and I'm grateful for it. – Michael Alexander May 02 '20 at 21:58
  • On my end I get a 404 Forbidden when trying to send email. Who knew a simple contact form would be such a major hassle. I'm considering just ditching it, though that reduces the user experience of the site. – Michael Alexander May 02 '20 at 22:41