aws-sdk-js-v3 icon indicating copy to clipboard operation
aws-sdk-js-v3 copied to clipboard

@aws-sdk/client-emr-containers cannot call describeJobRun

Open clhuang opened this issue 2 years ago • 3 comments

Describe the bug parsing of createdAt and finishedAt job fields do not appear to work

Is the issue in the browser/Node.js? Node.js

Details of the browser/Node.js version Paste output of npx envinfo --browsers or node -v

SDK version number @aws-sdk/[email protected]

To Reproduce (observed behavior)

const { EMRContainers } = require('@aws-sdk/client-emr-containers');
(async () => {
  const VIRTUAL_CLUSTER_ID = 'xxxxxxxxxx';
  const jobRunId = 'xxxxxxx';

  const client = new EMRContainers({
    region: 'us-west-2',
  });
  const data = await client.describeJobRun({
    id: jobRunId,
    virtualClusterId: VIRTUAL_CLUSTER_ID,
  });
})();

receive the error:

/Users/calvinhuang/scale/scaleapi3/server/node_modules/@aws-sdk/client-emr-containers/node_modules/@aws-sdk/smithy-client/dist-cjs/parse-utils.js:32
    throw new TypeError(`Expected number, got ${typeof value}`);
          ^

TypeError: Expected number, got string
    at expectNumber (/Users/calvinhuang/scale/scaleapi3/server/node_modules/@aws-sdk/client-emr-containers/node_modules/@aws-sdk/smithy-client/dist-cjs/parse-utils.js:32:11)
    at deserializeAws_restJson1JobRun (/Users/calvinhuang/scale/scaleapi3/server/node_modules/@aws-sdk/client-emr-containers/dist-cjs/protocols/Aws_restJson1.js:1497:124)
    at deserializeAws_restJson1DescribeJobRunCommand (/Users/calvinhuang/scale/scaleapi3/server/node_modules/@aws-sdk/client-emr-containers/dist-cjs/protocols/Aws_restJson1.js:767:27)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async /Users/calvinhuang/scale/scaleapi3/server/node_modules/@aws-sdk/client-emr-containers/node_modules/@aws-sdk/middleware-serde/dist-cjs/deserializerMiddleware.js:7:24
    at async /Users/calvinhuang/scale/scaleapi3/server/node_modules/@aws-sdk/client-emr-containers/node_modules/@aws-sdk/middleware-signing/dist-cjs/middleware.js:11:20
    at async StandardRetryStrategy.retry (/Users/calvinhuang/scale/scaleapi3/server/node_modules/@aws-sdk/client-emr-containers/node_modules/@aws-sdk/middleware-retry/dist-cjs/StandardRetryStrategy.js:51:46)
    at async /Users/calvinhuang/scale/scaleapi3/server/node_modules/@aws-sdk/client-emr-containers/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:6:22
    at async /Users/calvinhuang/scale/scaleapi3/server/thingy.js:11:16 {
  '$metadata': { attempts: 1, totalRetryDelay: 0 }
}

Expected behavior no error is thrown, data contains job data

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

clhuang avatar May 13 '22 18:05 clhuang

It appears the documentation is incorrect: https://docs.aws.amazon.com/emr-on-eks/latest/APIReference/API_DescribeJobRun.html

createdAt and finishedAt are stated as numbers, but when I make a HTTP call to the endpoint they're returned as ISO datestrings: image

clhuang avatar May 13 '22 18:05 clhuang

@clhuang thanks for opening this issue, I have reached out to the team internally to update the clients since I believe that might be causing deserialization issue.

Model generated in v2: https://github.com/aws/aws-sdk-js/blob/117773b94f05fed570c0122b7bbd958eedc47249/apis/emr-containers-2020-10-01.normal.json#L662 V3: https://github.com/aws/aws-sdk-js-v3/blob/378d16166de49b06263291001986715d9533cadf/codegen/sdk-codegen/aws-models/emr-containers.json

Rust and Go have seen similar issues too, would update you more on this soon.

ajredniwja avatar Jun 20 '22 14:06 ajredniwja

Was there a resolution to this? I am experiencing this problem in processing cloudsearch results. I get

"(output || []).filter is not a function Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object."

It is failing in de_FieldValue. output is not an array.

const de_FieldValue = (output, context) => { const retVal = (output || []) .filter((e) => e != null) .map((entry) => { if (entry === null) { return null; } return __expectString(entry); }); return retVal; };

escanzano avatar May 30 '23 02:05 escanzano