GithubHelp home page GithubHelp logo

Comments (15)

vvakame avatar vvakame commented on August 25, 2024 2

@thinkingserious I think this issue is not client side bug.
It can reproduce by cURL.

$ curl --request POST --url https://api.sendgrid.com/v3/mail/send --header 'Authorization: Bearer <my api key>' --header 'Content-Type: application/json' --data '{"from":{"name":"unit test","email":"[email protected]"},"subject":"unit test","personalizations":[{"to":[{"email":"[email protected]"}]}],"content":[{"type":"text/plain","value":"テキストだよ"},{"type":"text/html","value":"0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234 567890123456789012345678901234567890123456789012345678901234567890123456789 012345678901234567890123456789012345678901234567890123456789012345678901234 567890123456789012345678901234567890123456789012345678901234567890123456789 012345678901234567890123456789012345678901234567890123456789012345678901234 5678901234567890123456789012345678901234567890123456789"}]}'
{"errors":[{"message":"Unrecognized UTF8 Byte at position 1023","field":null,"help":"http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#-Encoding-Errors"}]}

from sendgrid-go.

lon9 avatar lon9 commented on August 25, 2024 1

@thinkingserious I got the same problem when I try to send email written in Japanese then email was not delivered and the error was appeared.

I think it is caused by the length of body. Please see the examples below.

package main

import (
    "fmt"
    "github.com/sendgrid/sendgrid-go"
    "github.com/sendgrid/sendgrid-go/helpers/mail"
    "os"
)

func main() {
    from := mail.NewEmail("sender", "[email protected]")
    to := mail.NewEmail("receiver", "[email protected]")
    content := mail.NewContent("text/plain", "こんにちは")
    m := mail.NewV3MailInit(from, "テスト", to, content)

    request := sendgrid.GetRequest(os.Getenv("SENDGRID_API_KEY"), "/v3/mail/send", "https://api.sendgrid.com")
    request.Method = "POST"
    request.Body = mail.GetRequestBody(m)
    resp, err := sendgrid.API(request)
    if err != nil {
        panic(err)
    }
    fmt.Println(resp.StatusCode)
    fmt.Println(resp.Body)
    fmt.Println(resp.Headers)
}

It's ok. but

package main

import (
    "fmt"
    "github.com/sendgrid/sendgrid-go"
    "github.com/sendgrid/sendgrid-go/helpers/mail"
    "os"
)

func main() {
    from := mail.NewEmail("sender", "[email protected]")
    to := mail.NewEmail("receiver", "[email protected]")
    content := mail.NewContent("text/plain", "こんにちはああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああ!!!!")
    m := mail.NewV3MailInit(from, "テスト", to, content)

    request := sendgrid.GetRequest(os.Getenv("SENDGRID_API_KEY"), "/v3/mail/send", "https://api.sendgrid.com")
    request.Method = "POST"
    request.Body = mail.GetRequestBody(m)
    resp, err := sendgrid.API(request)
    if err != nil {
        panic(err)
    }
    fmt.Println(resp.StatusCode)
    fmt.Println(resp.Body)
    fmt.Println(resp.Headers)
}

It outputs the error

415
{"errors":[{"message":"Unrecognized UTF8 Byte at position 1023","field":null,"help":"http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#-Encoding-Errors"}]}
map[Server:[nginx] Date:[Thu, 14 Jul 2016 11:06:56 GMT] Content-Type:[application/json] Content-Length:[172] Connection:[keep-alive]]

And, it's appeared in a byte of 2 of the multiplier - 1, for example 511 and 1023.

I hope it will be your help, and I use v2.0.0 with glide until it be fixed.

from sendgrid-go.

thinkingserious avatar thinkingserious commented on August 25, 2024 1

@norbergj,

I don't have an ETA, but the continued comments and votes help move it up the queue. Also, I will be advocating again for a quick fix today at our stand up.

@Rompei,

Thanks! I'll pass this along to the team.

from sendgrid-go.

vvakame avatar vvakame commented on August 25, 2024

any update?

from sendgrid-go.

thinkingserious avatar thinkingserious commented on August 25, 2024

This is in our queue to be fixed ASAP. I'll post any updates here.

Thanks!

from sendgrid-go.

vvakame avatar vvakame commented on August 25, 2024

any update?
I need a solution for my project. likes #65
Our project uses gb. but our sub projects can't use it.
CI system update github.com/sendgrid/sendgrid-go automatically.
Please consider using a gopkg.in .

from sendgrid-go.

csummers avatar csummers commented on August 25, 2024

@thinkingserious For clarity, is this a Sendgrid V3 server-side bug?

I think I am running into the same issue using the latest sendgrid-java client. Mail that used to go through V2 fails in V3 with the "Unrecognized UTF8 Byte" error message.

Update: Maybe it's not server-side. This looks like the relevant pull request, though it was admittedly harder to find since the corresponding sendgrid-java issue had already been closed: sendgrid/java-http-client#5 Sorry for the noise here.

from sendgrid-go.

thinkingserious avatar thinkingserious commented on August 25, 2024

@csummers,

It is a client side bug. The issue is that when we send the request body JSON, I did not consider the multi-byte characters when calculating the length, which causes it to be truncated.

Thanks for speaking up though because every voice helps bump the ticket up our queue to be fixed :)

from sendgrid-go.

thinkingserious avatar thinkingserious commented on August 25, 2024

Thanks for the additional information @vvakame!

from sendgrid-go.

thinkingserious avatar thinkingserious commented on August 25, 2024

If I do:

curl -X "POST" "https://api.sendgrid.com/v3/mail/send" \
        -H "Authorization: Bearer $SENDGRID_API_KEY"  \
        -H "Content-Type: application/json" \
        -d @post.json

where post.json is:

{
  "from": {
    "name": "unit test",
    "email": "[email protected]"
  },
  "subject": "unit test",
  "personalizations": [{
    "to": [{
      "email": "[email protected]"
    }]
  }],
  "content": [{
    "type": "text/plain",
    "value": "テキストだよ"
  }]
}

The email is delivered as expected.

There appears to be some issue in that string of numbers. Is there some sort of non utf-8 special character in there?

from sendgrid-go.

thinkingserious avatar thinkingserious commented on August 25, 2024

@vvakame,

I've been able to confirm that it is an API client issue and a bug has been filed. When it get's fixed, I'll post here. Thanks for your patience and help with tracking this issue down.

from sendgrid-go.

norbergj avatar norbergj commented on August 25, 2024

@thinkingserious

Do you have an ETA when this will be fixed?
I am currently evaluating if I can wait for the fix or if I should use v2 as described in #65

from sendgrid-go.

alxbog avatar alxbog commented on August 25, 2024

@thinkingserious Come on, guys! It's a blocker bug on server side that is known for a month already. I guess a lot of your clients believe their email are delivered when they are not.

from sendgrid-go.

thinkingserious avatar thinkingserious commented on August 25, 2024

@alxbog,

I sincerely wish it was fixed 3 months ago :(

The good news is that it's currently in this sprint and is now being actively worked on. I'm looking forward to announcing the fix very soon.

from sendgrid-go.

thinkingserious avatar thinkingserious commented on August 25, 2024

The fix for this has been deployed :)

Thank you for your patience!

from sendgrid-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.