FullstackReactCode icon indicating copy to clipboard operation
FullstackReactCode copied to clipboard

Sendgrid axios.post('/api/surveys', survey) not working even after changing updated Mailer.js from udemy Q&A

Open proust01 opened this issue 6 years ago • 0 comments

Hi, Stephen. thanks for all these support. I've been struggling test sending survey object with axios according to lecture 139 but even after updating new Mailer.js file, according to Martin from Q&A, it still doesn't work. This is error I got in my terminal.

and this is my github link : https://github.com/proust01/emaily/blob/master/services/Mailer.js

[0] (node:14108) UnhandledPromiseRejectionWarning: Error: Expecting object for Mail data [0] at Mail.fromData (C:\Users\David Cho\react-node\node_modules@sendgrid\helpers\classes\mail.js:55:13) [0] at new Mail (C:\Users\David Cho\react-node\node_modules@sendgrid\helpers\classes\mail.js:44:12) [0] at Function.create (C:\Users\David Cho\react-node\node_modules@sendgrid\helpers\classes\mail.js:627:12) [0] at MailService.send (C:\Users\David Cho\react-node\node_modules@sendgrid\mail\src\classes\mail-service.js:174:25) [0] at Mailer.send (C:\Users\David Cho\react-node\services\Mailer.js:28:29) [0] at app.post (C:\Users\David Cho\react-node\routes\surveyRoutes.js:26:17) [0] at Layer.handle [as handle_request] (C:\Users\David Cho\react-node\node_modules\express\lib\router\layer.js:95:5) [0] at next (C:\Users\David Cho\react-node\node_modules\express\lib\router\route.js:137:13) [0] at module.exports (C:\Users\David Cho\react-node\middlewares\requireCredits.js:5:5) [0] at Layer.handle [as handle_request] (C:\Users\David Cho\react-node\node_modules\express\lib\router\layer.js:95:5) [0] at next (C:\Users\David Cho\react-node\node_modules\express\lib\router\route.js:137:13) [0] at module.exports (C:\Users\David Cho\react-node\middlewares\requireLogin.js:5:5) [0] at Layer.handle [as handle_request] (C:\Users\David Cho\react-node\node_modules\express\lib\router\layer.js:95:5) [0] at next (C:\Users\David Cho\react-node\node_modules\express\lib\router\route.js:137:13) [0] at Route.dispatch (C:\Users\David Cho\react-node\node_modules\express\lib\router\route.js:112:3) [0] at Layer.handle [as handle_request] (C:\Users\David Cho\react-node\node_modules\express\lib\router\layer.js:95:5) [0] (node:14108) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

proust01 avatar Aug 18 '19 06:08 proust01