Sendgrid-nodejs: Send mail failed with v3 API and multi-byte contents

Created on 18 Jul 2016  ยท  6Comments  ยท  Source: sendgrid/sendgrid-nodejs

I have the same issue.

https://github.com/sendgrid/sendgrid-go/issues/66

It works.

var content = new helper.Content("text/plain", "ใ‚ใ‚ใ‚");

but, the following code does not work.

var content = new helper.Content("text/plain", "ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚");
{"errors":[{"message":"Unrecognized UTF8 Byte at position 510","field":null,"help":"http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#-Encoding-Errors"}]}

Is there any update?

work in progress bug

All 6 comments

@akifo,

This is currently being fixed, I've added you to the list of people to notify when the fix goes live.

Hello, thinkingserious.

Show you have any news? We start the project and we can not send invites to our first users?

@fockus,

It's moved into a higher priority, but I don't know exactly when it will be fixed. As soon as it is, I will let you know.

Same problem here:

var content = new helper.Content("text/html", html);
        var mail = new helper.Mail(from_email, subject, to_email, content);
        var requestBody = mail.toJSON();
        var request = sg.emptyRequest();
        request.method = 'POST';
        request.path = '/v3/mail/send';
        request.body = requestBody;
        sg.API(request, function (response) {
          sails.log.debug(response.statusCode);
          sails.log.debug(response.body);
          sails.log.debug(response.headers);
        });

Randomly gets:

{"errors":[{"message":"Unrecognized UTF8 Byte at position 511","field":null,"help":"http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#-Encoding-Errors"}

The emails are normal html, and it happens 1 per 10 emails more or less...

@JacobBarba this is a known server side issue and it currently being resolved in this sprint by our engineering team. I will be updating this thread when the fix is deployed.

The fix for this has been deployed :)

Thank you for your patience!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

prasoonjalan picture prasoonjalan  ยท  3Comments

nicoasp picture nicoasp  ยท  3Comments

zvone187 picture zvone187  ยท  4Comments

Loriot-n picture Loriot-n  ยท  4Comments

kiranshashiny picture kiranshashiny  ยท  4Comments