Currently if you try to cancel stream you would get the following error:
node_modules/@grpc/grpc-js/src/call.ts:115
this.call?.cancelWithStatus(Status.CANCELLED, 'Cancelled on client');
^
TypeError: Cannot read properties of undefined (reading 'call')
at cancel (node_modules/@grpc/grpc-js/src/call.ts:115:10)
at Timeout._onTimeout (/src/test.ts:31:3)
at listOnTimeout (node:internal/timers:573:17)
at process.processTimers (node:internal/timers:514:7)
Node.js v20.10.0
It happens because stream.cancel is not an arrow function so it loses it's this context.
Fix is to wrap it into arrow function to avoid this loosing it's context
Currently if you try to cancel stream you would get the following error:
It happens because stream.cancel is not an arrow function so it loses it's
this
context. Fix is to wrap it into arrow function to avoidthis
loosing it's context