awslabs/amazon-kinesis-client-nodejs

this._reportError is not a function

ivanmaximenko opened this issue · 4 comments

_reportError function is called in kcl_manager but it is not defined

this._reportError(util.format('Invalid action received: %j', action));

While this is not the ideal solution @ivanmaximenko,

I'm testing out patching the KCLManager prototype.

import * as KCLManager from 'aws-kcl/lib/kcl/kcl_manager'

if (KCLManager.prototype._reportError === undefined) {

  const logger = getLogger(__filename)

  logger.warn({}, 'defining _reportError on KCLManager')

  KCLManager.prototype._reportError = function (log: string) {
    logger.info({ reportError: true }, log)
  }
}

After the patch I got the real error message

Invalid action received: {"action":"shutdown","reason":"TERMINATE"}

There seems to be some missing cases in the action handler here

KCLManager.prototype._onAction = function(action) {

When compared to the ones which the parent Java process can send

https://github.com/awslabs/amazon-kinesis-client/tree/c8f82836b1cfcf84d456fde01f968ed69996c1c5/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/messages

Looks like the following are not handled at all

  • ShutdownMessage (shutdown)
  • StatusMessage (status)

I think the problem is that we are using KCL 1.x, where as v2.0.0 of this lib is designed for only KCL 2.0.0.
However they did not say they removed support for KCL 1.x in the release notes https://github.com/awslabs/amazon-kinesis-client-nodejs#release-200-march-6-2019 - perhaps this was implied ?