hoangvvo / nextjs-mongodb-app

A Next.js and MongoDB web application, designed with simplicity for learning and real-world applicability in mind.
https://nextjs-mongodb.now.sh/
MIT License
1.54k stars 289 forks source link

Email Verification Route Not Found #101

Closed CodMoncai closed 4 years ago

CodMoncai commented 4 years ago

I get the following error locally and also on a remote server. I have added in my own SendGrid API key, but I still get the following error. The path is valid and exists in the file structure.

Failed to load resource: the server responded with a status of 400 (Bad Request) for route - /api/user/email/verify

hoangvvo commented 4 years ago

That's odd. the handler of that route does not explicitly return 400 in any case. It might have come from sgMail.send. Can you try wrap that function with a try catch and log the error?

hoangvvo commented 4 years ago

Likely due to https://github.com/hoangvvo/nextjs-mongodb-app/issues/85. Using your own SendGrid token should work.

TechSavagery commented 3 years ago

I ran into a 500 error when attempting to verify my email address. After debugging it looks like sendgrid is requiring the subject property to be included in the message object.

Could not send email: Bad Request Bad Request (400) The subject is required. You can get around this requirement if you use a template with a subject defined or if every personalization has a subject defined. subject http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.subject