Skip to content

Bug: Wrong response type detection for newest grpc-js package #374

Description

@ScripterSugar

Describe the bug
As of now, mali inspects the type of call constructor of context request/response object in grpc server implementation, as we can see below:

function getCallTypeFromCall (call) {
  const name = Object.getPrototypeOf(call).constructor.name

  if (name.indexOf('ServerUnaryCall') === 0) {
    return CallType.UNARY
  } else if (name.indexOf('ServerWritableStream') === 0) {
    return CallType.RESPONSE_STREAM
  } else if (name.indexOf('ServerReadableStream') === 0) {
    return CallType.REQUEST_STREAM
  } else if (name.indexOf('ServerDuplexStream') === 0) {
    return CallType.DUPLEX
  }
}

However, an update to the @grpc/grpc-js package 2 months ago modified the unary call handler to use ServerWritableStreamImpl instead of ServerUnaryCallImpl. Consequently, Mali now mistakenly identifies all unary calls as stream calls.

To Reproduce
Steps to reproduce the behavior:
Install newest grpcjs package as peer dependency, and make unary call to mali instance.

Expected behavior
It should differentiate the unary and stream calls separately as intended.

Environment

  • Version: 0.47.1
  • Node.js version: 20
  • OS: macOS 14.0(23A344)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions