Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect arguments passed error when arg1 is a metadata type? #1768

Closed
ardok opened this issue Apr 28, 2021 · 3 comments
Closed

Incorrect arguments passed error when arg1 is a metadata type? #1768

ardok opened this issue Apr 28, 2021 · 3 comments

Comments

@ardok
Copy link

ardok commented Apr 28, 2021

Hi all,

So, just wondering. I'm facing this issue of Incorrect arguments passed error in my app.

Tracked it down to this part of the code:

      if (
        !(
          arg1 instanceof Metadata &&
          arg2 instanceof Object &&
          arg3 instanceof Function
        )
      ) {
        throw new Error('Incorrect arguments passed');
      }

I tried printing all the args:

            console.log(arg1 instanceof metadata_1.Metadata);
            console.log(arg2 instanceof Object);
            console.log(arg3 instanceof Function);
            if (!(arg1 instanceof metadata_1.Metadata &&
                arg2 instanceof Object &&
                arg3 instanceof Function)) {
                console.log(arg1);
                console.log(arg2);
                console.log(arg3);
                throw new Error('Incorrect arguments passed');
            }

And arg1 is a Metadata:

false
true
true
Metadata {
  internalRepr: Map {
    'rpc-caller' => [ 'my-web-app' ],
    'rpc-encoding' => [ 'proto' ],
    'rpc-service' => [ 'my-go-service' ]
  },
  options: {}
}
{
  serviceName: 'abacus-go',
  timeout: 10000,
  headers: undefined,
  deadline: 1619628947832
}
[Function: handleResponse]

Version:

"@grpc/grpc-js@^1.1.7":
  version "1.2.2"

Is this somehow enough to give me suggestions on what could be wrong? Or not at all?

@ardok
Copy link
Author

ardok commented Apr 28, 2021

Figured it out. It was just a classic dependency hell. Some packages use different versions of grpc-js.

@ardok ardok closed this as completed Apr 28, 2021
@robtayl0r
Copy link

You mind posting more info on what the solution/problem was? "Classic dependency hell" is a bit vacant.

@murgatroid99
Copy link
Member

I would guess that they had a Metadata object from one version of grpc-js and they were passing it to a method from a different version of grpc-js. This breaks the instanceof Metadata check because the Metadata classes from the two version of the library are separate objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants