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

gRPC client streaming and bidirectional streaming fail to pass headers #1458

Closed
BuddhiWathsala opened this issue Jun 14, 2021 · 3 comments · Fixed by ballerina-platform/module-ballerina-grpc#291
Assignees
Labels
module/grpc Points/1.5 Team/PCM Protocol connector packages related issues Type/Bug

Comments

@BuddhiWathsala
Copy link
Contributor

Description:
$title

Steps to reproduce:
Try gRPC client and bidirectional streaming with headers.

Affected Versions:
SL Beta 1 and 1.1

@BuddhiWathsala BuddhiWathsala added Type/Bug Team/PCM Protocol connector packages related issues module/grpc labels Jun 14, 2021
@BuddhiWathsala BuddhiWathsala self-assigned this Jun 14, 2021
@daneshk
Copy link
Member

daneshk commented Jun 14, 2021

Please find the sample test case to reproduce the issue: https://gist.github.com/daneshk/ff0cc9921cb7ebb509202894cceb3c1d

@daneshk
Copy link
Member

daneshk commented Jun 14, 2021

Seems like we didn't capture send headers on the client-side. We have two options here,

Option 01:
Pass the header values when we do the remote call, like

Chat39StreamingClient streamingClient = check chat39Ep->chat39(headers: {"x-id": "0987654321"});

Option 02:
Pass the header values when we send the first message using the streaming client,

Chat39StreamingClient streamingClient = check chat39Ep->chat39();
check streamingClient->sendContextChatMessage39({content: {name: "Sam", message: "Hi"}, headers: {"x-id": "0987654321"}});

@BuddhiWathsala
Copy link
Contributor Author

BuddhiWathsala commented Jun 18, 2021

Did not add these changes to the Ballerina level because it will unnecessarily break the previously generated stubs. Instead, handle context in Java similar to what we followed in the caller.

Seems like we didn't capture send headers on the client-side. We have two options here,

Option 01:
Pass the header values when we do the remote call, like

Chat39StreamingClient streamingClient = check chat39Ep->chat39(headers: {"x-id": "0987654321"});

Option 02:
Pass the header values when we send the first message using the streaming client,

Chat39StreamingClient streamingClient = check chat39Ep->chat39();
check streamingClient->sendContextChatMessage39({content: {name: "Sam", message: "Hi"}, headers: {"x-id": "0987654321"}});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/grpc Points/1.5 Team/PCM Protocol connector packages related issues Type/Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants