Usage of metadata in grpc interface

My k6 version is v0.38.3,When I use metadata in the grpc interface, the server cannot obtain the metadata content

Hi @miya.chen,
welcome to the community forum :tada:

When I use metadata in the grpc interface

Do you mean the params.metadata? Are you using something similar?

  const params = {
    metadata: { 'x-my-header': 'k6test' },
    tags: { k6test: 'yes' },

I see we are covering the common case on our automated tests. It would be useful if you can report more details about your issue. Please, include an anonymized script that you’re using or the relevant parts. If you could include also how you are reading the value on the gRPC server part that would be optimal.

In this way, we should be able to reproduce on our side the same flow.

Note: You’re using an old version of k6, can you try with the latest version and see if you can see the same issue?

This is my script. When I use postman (Version 9.30.4) or grpccurl, I can get correct results, but when I use k6, the server prints an error log: signature error

import grpc from 'k6/net/grpc';
import {check, sleep, group} from 'k6'

const client = new grpc.Client();
export default function () {

    const addr = ''
    client.connect(addr, {plaintext: true, reflect: true});
    const params = {

        metadata: {

    const payload = {
        "exchangeSource": "broker",
        "userId": "12345",
        "exchangeType": 2,
        "quoteType": 1,
        "applyReqBody": [
                "fromCoin": "DOGE",
                "fromAmount": "10000",
                "toCoin": "USDT",
                "sourceId": "alan11DOGETOUSDT28"
        "productCode": "alanTest2"

    const response = client.invoke('', payload, params);


I have found the reason. The value of “risk-sign-bin” in metadata should be coded by b64and my k6 should be upgraded to 0.4.

1 Like