Error message is not clear
{"message":"Response error","response":{"statusCode":400,"body":{"errors":[{"message":"Bad Request","field":null,"help":null}]},"headers":{"server":"n ginx","date":"Wed, 26 Apr 2017 01:14:46 GMT","content-type":"application/json","content-length":"63","connection":"close","x-frame-options":"DENY","ac cess-control-allow-origin":"https://sendgrid.api-docs.io","access-control-allow-methods":"POST","access-control-allow-headers":"Authorization, Content -Type, On-behalf-of, x-sg-elas-acl","access-control-max-age":"600","x-no-cors-reason":"https://sendgrid.com/docs/Classroom/Basics/API/cors.html"}}}
Hello @pashaseliverstov,
I agree, that error message is not clear at all. Could you please provide some additional details so I can get to the root of the problem and discover what the real error is?
- Do you mind providing the source code that generated that error?
- What is the value of
requestBodybefore you make the API call? - Was this how you retrieved the error?
Thanks!
With Best Regards,
Elmer
I have this same issue. did you find a solution @pashaseliverstov @thinkingserious ?
@temitope,
What version of the library are you using?
With Best Regards,
Elmer
Thanks @thinkingserious i am using this endpoint /v3/mail/send so I am assuming it is v3. Oddly it MAY be working if I change the destination email to a different value I think. super weird. still investigating. thanks
Is it possible that the error could occur if the CC and TO emails are the same?
Hi @temitope,
I am referring to the SDK version. Thanks!
And yes, we do not allow duplicate emails.
With Best Regards,
Elmer
Thank you so much for the timely response. It was version 5.1.0 and yes that duplicate address is the issue. I wish there was a specific error message/code reflecting that duplication issue, or simply a reduction/removal of one of the addresses, but I'm glad to finally know. @thinkingserious
Thanks @temitope!
I believe you will find the error handling to be superior in v6.X of this library.
With Best Regards,
Elmer
@thinkingserious wow, things got so much better and simpler in 6.X i see. thank you guys!
@temitope,
@adamreisnz deserves the lion's share of the thanks :)
indeed! thank you @adamreisnz you made my email-sending life a lot easier as a dev.
@temitope no problem! It made my own life easier as well, so it's a win-win ;)
give subject and template id and content type .it is saying error in body