K6 gRPC script works locally but times out on staging/production environment

import grpc from ‘k6/net/grpc’;
import { check, sleep } from ‘k6’;

export const options = {
insecureSkipTLSVerify: true,
};

const client = new grpc.Client();
client.load([‘definitions’], ‘Account.proto’);

export default () => {
client.connect(‘host:443’, {
plaintext: true
});

const data = {
“id”: “”,
“password”: “”,
};
const response = client.invoke(‘AccountProtoService/SignIn’, data);

check(response, {
‘status is OK’: (r) => r && r.status === grpc.StatusOK,
});

console.log(JSON.stringify(response.message));

client.close();
sleep(1);
};

simple request failing in prod stag environment but working perfectly in local.
When running script in prod with plaintext : false it gives error
{“message”:{“message”:“”,“success”:false},“error”:{“code”:2,“message”:“unexpected HTTP status code received from server: 426 (Upgrade Required); malformed header: missing HTTP content-type”,“details”:},“headers”:{},“trailers”:{},“status”:2} source=console
with plaintext:true it timeouts after 1 min giving error
ERRO[0060] GoError: context deadline exceeded: connection error: desc = “error reading server preface: read tcp 10.X.X.X:XXXX->20.X.X.X:X: use of closed network connection”
running at reflect.methodValueCall (native)

I am using .net 8 for my backend grpc server any help would be appreciated thanx

Hi @myoffacc07, welcome to the community forum!

Some googling suggest this is sometimes received if the method called is not implemented.

Given that you are saying this works locally but not in staging/prod I will expect that something isn’t matching between the two.

Can you please try to get it working with grpcurl both locally and in prod.

If you can’t do that - it is very likely not a problem with k6.

I can’t really guess based just on this what the problem can possibly be, but looking at logs in all of the involved servers might have more info.

Hope this helps!

Hello @mstoykov thankyou so much for your response. I have used bloom rpc its working fine for both stag and prod. But K6 is giving me error.