Comments (29)
Hi ALL, I know this is tooo late haha but if someone reach to same problem, check the from: '[email protected]', should be the email you set in your sendgrid account! Hope that helps
from fullstackreactcode.
I got the same error. I forgot "await" in the const response.
const response = await this.sgApi.API(request);
from fullstackreactcode.
for the ones that don't want to spend much time on this and just continue, I leave my Mailer.js
const keys = require('../config/keys'); const sgMail = require('@sendgrid/mail'); module.exports = async ({ subject, recipients }, content) => { // using SendGrid's v3 Node.js Library // https://github.com/sendgrid/sendgrid-nodejs sgMail.setApiKey(keys.sendGridKey); const formattedRecipients = recipients.map(({email}) => email); const msg = { to: formattedRecipients, from: '[email protected]', subject: subject, html: content, }; await sgMail.send(msg); }
and then the call in surveyRouter
Mailer(survey, surveyTemplate(survey));
This doesn't worked for me. Sad
Check from: '[email protected]' - set it to the email you set in your sendgrid account!
from fullstackreactcode.
In Mailer.js at line this.from_email=new helper.Email('[email protected]');
You have to replace this email with the authorized one which you created on sendgrid website.
from fullstackreactcode.
Guys, check your code well and compare it with one in repository. Everything works fine, I got no-reply mail and updated MongoDb!!! You must have made typo somewhere!!!!
from fullstackreactcode.
Grider used "sendgrid": "^5.1.2" which is now deprecated. Use "@sendgrid/mail" instead . Like this :
Mailer.js File
const keys = require("../config/keys");
const helper = require("@sendgrid/mail").setApiKey(keys.sendGridKey);
const Mailer = (survey, content) => {
const { subject, recipients } = survey;
const formatEmail = (emails) => {
const total = [];
emails.forEach((item) => {
total.push(item.email);
});
return total;
};
const msg = {
to: formatEmail(recipients),
from: {
name: "surveyApp.com",
email: "Your Varified Email at sengrid",
},
subject,
text: "hello",
html: content,
};
helper.send(msg).then(
(res) => {
console.log("email sent", res);
},
(error) => {
console.error(error);
if (error.response) {
console.error(error.response.body);
}
}
);
};
module.exports = Mailer;
surveyRoute.js
Mailer(survey, surveyTemplate(survey));
Thats should or must work ._
from fullstackreactcode.
@StephenGrider do you know why this might be an issue? you didn't seem to have this error in the tutorial and I double checked your code in the repo to make sure mine isnt missing anything
from fullstackreactcode.
looks like the error is thrown inside the try block in surveyRoutes
, in the await mailer.send()
line..
console:
removing await
from that line allows me to see all the other console logs but the request still fails and throws a 422
from fullstackreactcode.
Hi, I'm hitting the exact same problem, unclear how to proceed. Thanks for any information that can be provided!
from fullstackreactcode.
Be careful! In Mailer.js, path:'v3/mail/send', NOT path:'V3/mail/send'
from fullstackreactcode.
@rostgoat @nitini
In Mailer.js class please double check that the content variable is not wrapped inside of quotation marks You should have line like this this.body = new helper.Content('text/html', content)
NOT like this this.body = new helper.Content('text/html, content')
Had a similar issue
Hope it helps!
from fullstackreactcode.
[0] (node:31420) UnhandledPromiseRejectionWarning: SendGridError: Response error [0] at F:\Web Development\MERN\Projects\Feedback\server\node_modules\sendgrid\lib\sendgrid.js:104:23 [0] at IncomingMessage.<anonymous> (F:\Web Development\MERN\Projects\Feedback\server\node_modules\sendgrid-rest\lib\client.js:112:9) [0] at IncomingMessage.emit (events.js:187:15) [0] at endReadableNT (_stream_readable.js:1094:12) [0] at process._tickCallback (internal/process/next_tick.js:63:19) [0] (node:31420) 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: 1) [0] (node:31420) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Getting the same error
from fullstackreactcode.
triplecheck the send() method in Mailer.js, he added the await there while in the tutorial, he didn't.
from fullstackreactcode.
from fullstackreactcode.
for the ones that don't want to spend much time on this and just continue, I leave my Mailer.js
const keys = require('../config/keys');
const sgMail = require('@sendgrid/mail');
module.exports = async ({ subject, recipients }, content) => {
// using SendGrid's v3 Node.js Library
// https://github.com/sendgrid/sendgrid-nodejs
sgMail.setApiKey(keys.sendGridKey);
const formattedRecipients = recipients.map(({email}) => email);
const msg = {
to: formattedRecipients,
from: '[email protected]',
subject: subject,
html: content,
};
await sgMail.send(msg);
}
and then the call in surveyRouter
Mailer(survey, surveyTemplate(survey));
from fullstackreactcode.
I'm getting same error .. any solution ?
from fullstackreactcode.
Yes I am also getting same error.
from fullstackreactcode.
for the ones that don't want to spend much time on this and just continue, I leave my Mailer.js
const keys = require('../config/keys'); const sgMail = require('@sendgrid/mail'); module.exports = async ({ subject, recipients }, content) => { // using SendGrid's v3 Node.js Library // https://github.com/sendgrid/sendgrid-nodejs sgMail.setApiKey(keys.sendGridKey); const formattedRecipients = recipients.map(({email}) => email); const msg = { to: formattedRecipients, from: '[email protected]', subject: subject, html: content, }; await sgMail.send(msg); }
and then the call in surveyRouter
Mailer(survey, surveyTemplate(survey));
This doesn't worked for me. Sad
from fullstackreactcode.
SEND_GRID { [0] errors: [ [0] { [0] message: 'The from address does not match a verified Sender Identity. Mail cannot be sent until this error is resolved. Visit https://sendgrid.com/docs/for-developers/sending-email/sender-identity/ to see the Sender Identity requirements', [0] field: 'from', [0] help: null [0] } [0] ]
You need to setup a Sender Identity, if you are using Free Trial and received access on or after April 6, 2020. For POCs its best to
choose Single Sender Verification. More information here : https://sendgrid.com/docs/for-developers/sending-email/sender-identity/
from fullstackreactcode.
Hey I tried all of the methods but still getting this error,
Please help @StephenGrider
Here is my Mailer.js:
https://drive.google.com/file/d/1uGvjVjwrfoa8MJKd81iVj0qWthbvQU_n/view?usp=sharing
client/src/index.js:
https://drive.google.com/file/d/1yw47JKhbve1T8-7oaVuuui2fkHynKhlu/view?usp=sharing
surveyRoutes.js
https://drive.google.com/file/d/1nts2u2Wzb-YEqesXNrk1IOvTIoPvMfDo/view?usp=sharing
from fullstackreactcode.
SEND_GRID { [0] errors: [ [0] { [0] message: 'The from address does not match a verified Sender Identity. Mail cannot be sent until this error is resolved. Visit https://sendgrid.com/docs/for-developers/sending-email/sender-identity/ to see the Sender Identity requirements', [0] field: 'from', [0] help: null [0] } [0] ]
You need to setup a Sender Identity, if you are using Free Trial and received access on or after April 6, 2020. For POCs its best to
choose Single Sender Verification. More information here : https://sendgrid.com/docs/for-developers/sending-email/sender-identity/
Hey,
What if we do not create both domain or single sender verification?
Is this necessary to do the domain/single sender verification?
from fullstackreactcode.
Hi ALL, I know this is tooo late haha but if someone reach to same problem, check the from: '[email protected]', should be the email you set in your sendgrid account! Hope that helps
Thanks, this is what worked for me.
from fullstackreactcode.
this.from_email = new helper.Email("sender mail id");
you just have to use this in Mailer.js.
And make sure that you are using same mail id which you have set as a sender mail id in sendgrid.
from fullstackreactcode.
To resolve the issue, I put const response = await this.sgApi.API(request);
in a try-catch block. This would also help to reveal if there are other errors you made in your code.
from fullstackreactcode.
from fullstackreactcode.
from fullstackreactcode.
I had this issue, my falut was forget to verify sender in sendgrid. Please remeber to verify the sender!!!
from fullstackreactcode.
@StephenGrider do you know why this might be an issue? you didn't seem to have this error in the tutorial and I double checked your code in the repo to make sure mine isnt missing anything
I had this issue, my falut was forget to verify sender in sendgrid. Please remeber to verify the sender!!!
from fullstackreactcode.
@darda-ergo thank you buddy! it worked out for me after i followed your code !
from fullstackreactcode.
Related Issues (20)
- Bug: Heroku Deployment error with this project. The error message points to, and suggests a solution to, the eslint module in the node_modules folder where 'require() of ES modules is not supported' HOT 1
- Failed to deploy server to Heroku. Please help!!! HOT 1
- Could not proxy request /api/v1/products?keyword=&page=1&price[gte]=0&price[lte]=25000&ratings[gte]=0 from localhost:3000 to http://192.168.29.21:4000.
- Stuck at "Choose An Account" page for 1 minute, then Application Error HOT 1
- Heroku application error: request timeout (503) HOT 8
- ""
- After loggin to app it redirect to localhost:5000/surveys HOT 7
- Fix for proxy issue in "Routing Stumbling Block" HOT 1
- Error when saving the second user in database HOT 1
- req.user.save is not a function HOT 1
- Package Update Necessary
- err
- UnhandledPromiseRejectionWarning: SendGridError: Response error ; Layman Fix HOT 5
- Few tips for successfully running the code in 2020 HOT 2
- Why does string literals not work?
- Why does the profile google OAuth logs twice? HOT 1
- After clicking on yes/no from the mail, no information is coming back to console. HOT 1
- Heroku Application Error
- Github Oauth
- withRouter not exported from 'react-router-dom'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fullstackreactcode.