grpc / grpc-node

gRPC for Node.js
https://grpc.io
Apache License 2.0
4.4k stars 626 forks source link

Exception at Http2CallStream.<anonymous>(@grpc.grpc-js.build.src:client) #1019

Open francovp opened 4 years ago

francovp commented 4 years ago

Problem description

Getting lots of errors like this:

Error at Http2CallStream.<anonymous> (/usr/src/app/node_modules/@grpc/grpc-js/build/src/client.js:96:45) at Http2CallStream.emit (events.js:205:15) at Http2CallStream.EventEmitter.emit (domain.js:471:20) at /usr/src/app/node_modules/@grpc/grpc-js/build/src/call-stream.js:71:22 at processTicksAndRejections (internal/process/task_queues.js:82:9) { code: 14, details: '', metadata: Metadata { options: undefined, internalRepr: Map {} } }

Exception:

Error: null
  File "/usr/src/app/node_modules/@grpc/grpc-js/build/src/client.js", line 96, col 45, in Http2CallStream.<anonymous>
    const error = Object.assign(new Error(status.details), status);
  File "events.js", line 205, col 15, in Http2CallStream.emit
  File "domain.js", line 471, col 20, in Http2CallStream.EventEmitter.emit
  File "/usr/src/app/node_modules/@grpc/grpc-js/build/src/call-stream.js", line 71, col 22, in null.<anonymous>
    this.emit('status', status);
  File "internal/process/task_queues.js", line 82, col 9, in processTicksAndRejections

What does this means?

Reproduction steps

This begins happens when I updated firebase-admin to 8.4.0 and googleapis to 42.0.0

Environment

murgatroid99 commented 4 years ago

Are you calling a function that returns a promise? If so, are you handling the promise rejection?

francovp commented 4 years ago

I'm not using this library directly, I think it is a dependency of the googleapis or firebase-admin libraries and it started appearing in my logs after updating those libraries. Maybe I should open an Issue in those repositories? Or you think it's a promise rejection that I not handling in my logic? I don't know why I'm not getting the right stacktrace in my logs. I'm using Sentry service to capture exceptions.

murgatroid99 commented 4 years ago

Yes, I'm suggesting that this is a promise rejection that you are not handling. The gRPC library itself does not use promises, and it does not throw these errors. The stacktrace seems to come from where the error was constructed, and those other libraries just propagate the error object.

gae123 commented 4 years ago

We see this error on GCP. We use many google API libraries and I am convinced that this is coming from one or more of them. We do not use firebase.

jiakuanATF commented 4 years ago

We also see such an error in our scheduled cloud functions on GCP. Is there any update?

Screen Shot 2020-03-30 at 11 33 22

Download commented 4 years ago

Seeing this too.

The error is being thrown from client.js. This code:

call.on('status', (status) => {
  /* We assume that call emits status after it emits end, and that it
    * accounts for any cancelWithStatus calls up until it emits status.
    * Therefore, considering the above event handlers, status.code should be
    * OK if and only if we have a non-null responseMessage */
  if (status.code === constants_1.Status.OK) {
    callback(null, responseMessage);
  }
  else {
    const error = Object.assign(new Error(status.details), status);
    callback(error);
  }
});
murgatroid99 commented 4 years ago

That's the code that creates an error from the call's status. As you can see, that error is just passed to a callback. If that error is getting thrown it is by whatever code is handling the callback.