ts-proto icon indicating copy to clipboard operation
ts-proto copied to clipboard

Rpc doesn't account for metadata

Open fizx opened this issue 4 months ago • 2 comments

interface Rpc {
  request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
}

There's an option to include a metadata?: Metadata arg, but only under certain providers. There's also no option to receive Metadata from the response.

This seems like a pretty wide-ranging potential change. Have people run into this problem before?

fizx avatar Apr 12 '24 18:04 fizx

I think most users have used metadata on the server, i.e. to accept incoming data like auth headers.

Also I think that its the client Rpc implementations that put this metadata on the wire, and not the individual call sites that are calling SomeService.someMethod.

If you needed to pass per-callsite metadata into a await someService.someMethod(...) call, and have that passed through the Rpc interface, then yeah we do not support that atm.

Do you need to do that? Or can you follow the ^ pattern and have the Rpc implementation generically put the same auth/user metadata on the wire for all calls?

stephenh avatar Apr 13 '24 18:04 stephenh

We’re trying to thread trace ids through, which gets tricky I think.  Let me think more about workaroundsOn Apr 13, 2024, at 12:44 PM, Stephen Haberman @.***> wrote: I think most users have used metadata on the server, i.e. to accept incoming data like auth headers. Also I think that its the client Rpc implementations that put this metadata on the wire, and not the individual call sites that are calling SomeService.someMethod. If you needed to pass per-callsite metadata into a await someService.someMethod(...) call, and have that passed through the Rpc interface, then yeah we do not support that atm. Do you need to do that? Or can you follow the ^ pattern and have the Rpc implementation generically put the same auth/user metadata on the wire for all calls?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

fizx avatar Apr 13 '24 19:04 fizx