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

Question|Feature: Sending Binary Metadata #72

nevi-me opened this Issue Mar 24, 2018 · 5 comments


None yet
4 participants

nevi-me commented Mar 24, 2018

The grpc spec allows for sending metadata-bin as binary metadata. Is this currently supported?


Repro steps

  1. Create a grpc-dart client to connect to a server

  2. Create a client call including a binary metadata key with a text value

    channel.stub.myMethod(new Request(), options: new CallOptions(metadata: {
      "testmetadata": "a string",
      "testmetadata-bin": "supposed to be binary"
    }, timeout: new Duration(seconds: 15))).then((Response response) {
    }).catchError((GrpcError error) {
      print("******* ${error.message} ******");

Expected result: The request should either throw an error about malformed *-bin metadata, or discard the metadata

Actual result: The request sends the metadata, but there's a failure on the server (tested with NodeJS and Java)


The request seems to silently fail on both NodeJS and Java, I tried getting log output, but couldn't find anything. I use nghttpx as my proxy, and it passed the testmetadata-bin as I supplied it.

One of the reasons why I use binary metadata is to pass my custom error messages as protobuf messages. I suppose it's a question for another day, but how would I deal with bytedata in dart? Do I use Uint8List?


This comment has been minimized.

nevi-me commented Mar 24, 2018

I forgot to mention, removing the binary metadata field results in a successful call.

As a side note, flutter with gRPC is a dream so far! I'm rewriting an Android app that I gave up on after over a month, and within 2 days, I'm about 70% done with the same spec app using Flutter!


This comment has been minimized.


jakobr-google commented Apr 6, 2018

Byte data in Dart is a Uint8List, yes.

There's currently no special support for binary metadata, so with the current code, you'll need to base64-encode the data yourself. Something like:

metadata: { 'testmetadata-bin': base64.encode(binaryData) }

(where base64 is from dart:convert)

I'll keep this issue open to provide better support for binary metadata.


This comment has been minimized.

gedw99 commented May 9, 2018

+1. i need this too. Prefer not ot have to base64 it :)


This comment has been minimized.

nevi-me commented May 9, 2018

@gedw99 from my understanding, you can successfully send binary metadata, the library doesn't yet go the extra mile of checking whether a *-bin contains binary data, but it shouldn't stop us from using binary metadata.


This comment has been minimized.

gedw99 commented May 9, 2018

@mit-mit mit-mit added the enhancement label Jul 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment