I am getting the serialisation error when sending the following data as a payload to the gRPC request.
Sample Test:
import grpc from 'k6/net/grpc';
import { check, sleep } from 'k6';
const client = new grpc.Client();
client.load(['definitions'], 'test_service.proto');
export default () => {
client.connect('host-eu-west-1.amazonaws.com:9008', {
plaintext: true
});
const data = {
"key": {
"name": "Hello",
"path": "0"
},
"hash": [72,
101,
108,
108,
111,
72,
101,
108,
108,
111,
72,
101,
108,
108,
111,
72,
101,
108,
108,
111,
72,
101,
108,
108,
111,
72,
101,
108,
108,
111,
10,
12]
};
const response = client.invoke('proto.Service/SignIn', data);
check(response, {
'status is OK': (r) => r && r.status === grpc.StatusOK,
});
console.log(JSON.stringify(response.message));
client.close();
sleep(1);
};
Example Proto
message Request {
key key = 1;
bytes hash = 2; // array of bytes containing the hash you wish to sign
}
message Response {
bytes sign = 1; // array of bytes containing signature of the hash
bytes public = 2; // array of bytes containing the public key
}
And the error response I am getting is
ERRO[0000] unable to serialise request object to protocol buffer: proto: (line 1:52): invalid value for bytes type: [
at go.k6.io/k6/js/common.Bind.func1 (native)
at file:///Users/ven/Documents/k6-grpc/signintestdebug.js:59:66(88) executor=per-vu-iterations scenario=default source=stacktrace