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

Support Any.proto for GRPC #2447

Closed
CandiedCode opened this issue Mar 16, 2022 · 5 comments · Fixed by #2523
Closed

Support Any.proto for GRPC #2447

CandiedCode opened this issue Mar 16, 2022 · 5 comments · Fixed by #2523
Assignees
Labels
area: grpc bug evaluation needed proposal needs to be validated or tested before fully implementing it in k6 triage
Milestone

Comments

@CandiedCode
Copy link

CandiedCode commented Mar 16, 2022

Brief summary

For a GRPC service whose message type uses Any.proto. K6 is unable to locate the protobuf to serialize to the given type.

Given a data object such as

{ context: 'test',
   payload: {
            "@type": "type.googleapis.com/test.Client",
            "client_id": 1234,
          },
}

k6 will throw an error:
unable to serialise request object to protocol buffer: proto: (line 1:157): unable to resolve "type.googleapis.com/test.Client": "not found"

k6 version

k6 v0.36.0 ((devel), go1.17.6, darwin/amd64)

OS

macOS Montery

Docker version and image (if applicable)

No response

Steps to reproduce the problem

For a given grpc service such as

syntax = "proto3";

package test;

import "google/protobuf/any.proto";

service Publisher {
    rpc Publish (PublishRequest) returns (PublishResponse);
}

message PublishRequest {
    string context = 1;
    google.protobuf.Any payload = 3;
}
...

That references Any.proto, k6 is not able to serialize to the expected protobuf type, even if it's part of the client.load protobuf definitions.

client.load(['event-schemas/protobufs', '../../protos'],
    'context.proto',
    'action.proto',
    'client.proto',  # example protobuf definitions from event-schema that we want to pack as Any.proto
    'relay.proto',  # part of the grpc service
    );

The protobuf descriptors seem to load correctly, but since they aren't directly related to a service descriptor I think they are filtered out here possibly and fails here.

Expected behaviour

Any.proto is able to seralize to any proto passed into client.load.serialize

Actual behaviour

Exception thrown

unable to serialise request object to protocol buffer: proto: (line 1:157): unable to resolve "type.googleapis.com/test.Client": "not found"

@na-- na-- added area: grpc evaluation needed proposal needs to be validated or tested before fully implementing it in k6 labels Mar 18, 2022
@codebien codebien self-assigned this Apr 1, 2022
@codebien codebien removed their assignment May 25, 2022
@na-- na-- added this to the v0.39.0 milestone Jun 8, 2022
@jamie-macdonald
Copy link

has this been released? and what version is it in?

@na--
Copy link
Member

na-- commented Sep 21, 2022

Yes, this has been released in k6 v0.39.0, as the issue milestone suggests: https://github.com/grafana/k6/blob/master/release%20notes/v0.39.0.md#bug-fixes

If you think there is another bug, please open a new issue about it. And if you are having problems with using it, feel free to ask for advice in the community forum at https://community.k6.io/

@jamie-macdonald
Copy link

Thanks its working, after the usual amount of playing. yeah!

@amnbcw
Copy link

amnbcw commented Nov 22, 2024

I am using k6 v0.54.0 (commit/baba871c8a, go1.23.1, linux/amd64), and still running into this issue. :/

@inancgumus
Copy link
Member

Hi @amnbcw, can you give us the steps to reproduce the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: grpc bug evaluation needed proposal needs to be validated or tested before fully implementing it in k6 triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants