node.jstypescriptgrpcgrpc-js

Error during signUp: Error: 13 INTERNAL: Received RST_STREAM with code 2 triggered by internal client error: Protocol error


I am getting following error when i try to make grpc call using my node client:

code: 13,
  details: 'Received RST_STREAM with code 2 triggered by internal client error: Protocol error',
  metadata: Metadata { internalRepr: Map(0) {}, options: {} }

Following is how am trying to make the call: SingUpRequest and CustomerServiceExternalClient is imported from my protos

 grpcClient: CustomerServiceExternalClient
 constructor(){
this.grpcClient = new CustomerServiceExternalClient(
       'mygrpcserveraddress', 
      ChannelCredentials.createInsecure() 
    )
}

async myfunction() {
const signUpRequest: SignUpRequest = {
      signInAttributeKey: 'somekey',
      signInAttributeValue: '3333333333339', 
      requestMetadata: {}, 
    }

    try {
      const signUpResponse = await new Promise((resolve, reject) => {
        this.grpcClient.signUp(signUpRequest, (error, response) => {
          if (error) {
            reject(error)
          } else {
            resolve(response)
          }
        })
      })

      console.log('SignUp successful:', signUpResponse)
    } catch (error) {
      console.error('Error during signUp:', error)
      throw error 
    }

}

I tried calling grpc function SignUp but it gave me following error:

  code: 13,
  details: 'Received RST_STREAM with code 2 triggered by internal client error: Protocol error',
  metadata: Metadata { internalRepr: Map(0) {}, options: {} }

Note: I have tested the same grpc call using postman using same server address and port and it is working. This error only occur when running my client.


Solution

  • The issue was with SSL certificate.. while creating client i was using createInsecure() instead of createSSL function. [ChannelCredentials.createSsl()]