aws / aws-sdk-js-v3

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

@aws-sdk/client-quicksight TypeError: entry.getTime is not a function #6176

Closed charlydi closed 3 months ago

charlydi commented 3 months ago

Checkboxes for prior research

Describe the bug

QuickSight client fails to create new Analysis resource with the error: TypeError: entry.getTime is not a function

SDK version number

@aws-sdk/client-quicksight@3.590.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

18.17.1

Reproduction Steps

// if the resouce already exists in aws, resource is marked for deletion
// (creation will happen in other process)
// if the resource does not exist on aws, resources is created (current scenario
// where error is happening)

// Initialization of client and placeholders mapping
const qs = getAWSQSClient(args.awsRegion!, args.awsProfile!);
const templatePlaceholders = {
  awsAccount: args.awsAccount!,
  awsRegion: args.awsRegion!,
  etlPrefix: args.etlPrefix!,
};

// template Object is parsed into a string and all placeholders are replaced to
// generate the analysis definition that will be deployed
const templateStr = removeTemplatePlaceholders(
  JSON.stringify(template),
  templatePlaceholders,
);
// AnalysisDef is a simple interface that has the required information to
// create a new analysis resource using qs client 
const analysisDef = JSON.parse(templateStr) as AnalysisDef;

// once the resource definition is ready, helper fn to create the resource is
// called
await createAnalysis(
  client,
  analysisDef,
  templatePlaceholders.awsAccount,
);

// inside createAnalysis function: definition = analysisDef
const analysisReq = await client.send(
new CreateAnalysisCommand({
  AnalysisId: definition.details.AnalysisId,
  AwsAccountId: awsAccount,
  Name: definition.details.Name,
  Definition: definition.definition,
  ThemeArn: definition.details.ThemeArn,
}),
);

Observed Behavior

Deploying Analyses...

/Users/user/node_modules/@aws-sdk/client-quicksig
ht/dist-cjs/index.js:10754
    return entry.getTime() / 1e3;
                 ^

TypeError: entry.getTime is not a function
    at /Users/user/node_modules/@aws-sdk/client-q
uicksight/dist-cjs/index.js:10754:18
    at Array.map (<anonymous>)
    at se_DateTimeDefaultValueList (/Users/user/n
ode_modules/@aws-sdk/client-quicksight/dist-cjs/index.js:10753:41)
    at StaticValues (/Users/user/node_modules/@aw
s-sdk/client-quicksight/dist-cjs/index.js:10761:26)
    at applyInstruction (/Users/user/node_modules
/@smithy/smithy-client/dist-cjs/index.js:1089:27)
    at take (/Users/user/node_modules/@smithy/smi
thy-client/dist-cjs/index.js:1057:5)
    at se_DateTimeDefaultValues (/Users/user/node
_modules/@aws-sdk/client-quicksight/dist-cjs/index.js:10758:40)
    at DefaultValues (/Users/user/node_modules/@a
ws-sdk/client-quicksight/dist-cjs/index.js:10778:27)
    at applyInstruction (/Users/user/node_modules
/@smithy/smithy-client/dist-cjs/index.js:1089:27)
    at take (/Users/user/node_modules/@smithy/smi
thy-client/dist-cjs/index.js:1057:5)

Expected Behavior

New QS Analysis been created

Possible Solution

Probably related to #6151 despite being in a different module

Additional Information/Context

No response

nyamurray commented 3 months ago

A timestamp in the format "Timestamp":"2024-06-10T07:41:13.067Z" is now working.

aBurmeseDev commented 3 months ago

Hi @charlydi - appreciate you for reaching out.

I see that there was already ongoing conversation in https://github.com/aws/aws-sdk-js-v3/issues/6151 and from giving a quick glance at it, there might be conflict between the format service API uses and how it's actually documented. I'll need to sync up with other member for further investigation. Since this's the same topic, I'm going to close this in favor of the other issue so that we can track it in one place.

@nyamurray could you please elaborate more on your findings in the original issue? Thank you!

github-actions[bot] commented 3 months 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.