Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON message is not unmarshalling correctly into protobuf message #16

Open
thatjiaozi opened this issue Jan 29, 2020 · 1 comment
Open

Comments

@thatjiaozi
Copy link
Collaborator

It seems that when the database is updated and receives a new version token the unmarshalling is not done correctly.

Expected: Cg0IARAGGAEiAzAwMTABEP/7BhoCGAnR73ir
unmarshalled: [10 13 8 1 16 6 24 1 34 3 48 48 49 48 1 16 255 251 6 26 2 24 9 209 239 120 171]

This could be an issue with https://godoc.org/github.com/golang/protobuf/jsonpb itself.

I created the branch json-marshalling-bug for future investigation, meanwhile i am going to revert the changes that introduced this bug.

@jiayuanmasc
Copy link
Contributor

I believe the issue is due to that versionToken is not base64 encoded here. The error message from the API looks like

"error": {
    "code": 400,
    "message": "Invalid value at 'version_token' (TYPE_BYTES), Base64 decoding failed for \"\n\r\b\u0001\u0010\u0006\u0018\u0001\"\u00030010\u0001\u0010  \u0007\u001a\u0002\u0018\u0003 h 8\"",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "field": "version_token",
            "description": "Invalid value at 'version_token' (TYPE_BYTES), Base64 decoding failed for \"\n\r\b\u0001\u0010\u0006\u0018\u0001\"\u00030010\u0001\u0010  \u0007\u001a\u0002\u0018\u0003 h 8\""
          }
        ]
      }
    ]
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants