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

Passing metadata through proxy? #91

Closed
endpress opened this issue Sep 27, 2017 · 6 comments
Closed

Passing metadata through proxy? #91

endpress opened this issue Sep 27, 2017 · 6 comments

Comments

@endpress
Copy link

I am using grpcwebproxy. My backend server is a node js grpc server. I want pass metadata through grpc-web-client.

  const testRequest = new TestRequest();
  testRequest.setUserId('testuserid');

  grpc.unary(MeetService.testHistory, {
    request: testRequest,
    host: host,
    debug: true,
    metadata: {test_token: 'xxxxxxxxxxx'},
    onEnd: res => {
      const { status, statusMessage, headers, message, trailers } = res;
      if (status === Code.OK && message) {
        // console.log('meetHistory.onEnd.message', message.toObject());
      }
      // console.log('meetHistory.onEnd.trailers', trailers);
    }
  });

But my node server cannot get metadata. It only can get a user-agent metadata.

Metadata { _internal_repr: { 'user-agent': [ 'grpc-go/1.7.0-dev' ] } }
ServerUnaryCall {
  domain: null,
  _events: { error: [Function] },
  _eventsCount: 1,
  _maxListeners: undefined,
  call: Call {},
  cancelled: false,
  metadata: Metadata { _internal_repr: { 'user-agent': [Array] } },
  request: 
   { wrappers_: null,
     messageId_: undefined,
     arrayIndexOffset_: -1,
     array: [ 'testuserid' ],
     pivot_: 1.7976931348623157e+308,
     convertedFloatingPointFields_: {} } }
@endpress
Copy link
Author

My grpc-web-client version is "grpc-web-client": "^0.3.1",

@ypoluektovich
Copy link

I'm seeing the same problem. The go proxy thing seems to be swallowing metadata/headers.

@suusan2go
Copy link

I have the same problem. My backend server is a SpringBoot server(with grpc-java using Kotlin.)

@mwitkow
Copy link

mwitkow commented Nov 20, 2017

Indeed. The previous code of grpc-proxy, that the current grpc-webproxy relies on, relied on the implicit forwarding of metadata inside the context.Context between gRPC-Go calls. This behaviour has changed in gRPC-Go 1.5.

The fix requires a change to upstream grpc-go and is discussed in
mwitkow/grpc-proxy#19

@MarcusLongmuir
Copy link
Contributor

@endpress / @ypoluektovich / @suusan2go: Please re-open if latest master does not fix the issue you're seeing.

@ypoluektovich
Copy link

It does for me. Thanks!

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

5 participants