aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
3.05k stars 572 forks source link

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

Closed clhuang closed 2 months ago

clhuang commented 2 years ago

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/client-emr-containers@3.87.0

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 commented 2 years ago

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

ajredniwja commented 2 years ago

@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.

escanzano commented 1 year ago

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; };

RanVaknin commented 2 months ago

This should be fixed.

github-actions[bot] commented 1 month ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.