http-aws-es icon indicating copy to clipboard operation
http-aws-es copied to clipboard

Error: The "data" argument must be one of type string, TypedArray, or DataView. Received type undefined

Open john-aws opened this issue 5 years ago • 0 comments

When using http-aws-es, if you fail to explicitly update your AWS configuration object with a region (e.g. aws.config.update({ region: "us-east-1" })) then searches using elasticsearch/http-aws-es fail with the misleading error message:

The "data" argument must be one of type string, TypedArray, or DataView. Received type undefined

This is accompanied by a stack trace such as:

Elasticsearch ERROR: 2020-03-11T13:02:48Z
  Error: Request error, retrying
  POST https://search-endpoint-01/kibana_sample_data_flights/_search?size=10 => The "data" argument must be one of type string, TypedArray, or DataView. Received type undefined
      at Log.error (myproject/node_modules/elasticsearch/src/lib/log.js:226:56)
      at checkRespForFailure (myproject/node_modules/elasticsearch/src/lib/transport.js:259:18)
      at done (myproject/node_modules/http-aws-es/connector.js:48:7)
      at process._tickCallback (internal/process/next_tick.js:68:7)
      at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
      at startup (internal/bootstrap/node.js:283:19)
      at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

Because this error message is so unrelated to the root cause, I wonder if http-aws-es could test for this condition and provide better diagnostics. If not, hopefully the existence of this github issue will at least help the next person who hits this problem.

I suspect the actual validation that triggers this error may be in an underlying crypto module.

john-aws avatar Mar 11 '20 13:03 john-aws