-
Notifications
You must be signed in to change notification settings - Fork 603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
client-cloudwatch not taking milliseconds since 1970 #6862
Comments
Hi @codermpl - thanks for reaching out. Which SDK language are you using and are you running into any issue? Could you share your code snippet along with the error if any? |
language is typescript |
code example:
Type 'number' is not assignable to type 'Date'.ts(2322) |
const input: PutMetricDataInput = {
Namespace: 'abc',
MetricData: [{
MetricName: 'name',
Timestamp: new Date() // Convert to Date object or alternative new Date(Date.now())
}],
}; |
Yes, that's the bug. It expects a Date, but it's supposed to expect a number.
|
Based on the service model, it expects |
Checkboxes for prior research
Describe the bug
client-cloudwatch MetricDatum interface says.
This seems to be conflicting. The comment says it should take number of ms, but the type signature says it should take a Date object. API documentation confirms it's supposed to take ms since 1970: https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html
I'd be happy if it could take either Date or ms as a number. But seems like it should at least take ms since that's what the API spec says.
Regression Issue
SDK version number
"@aws-sdk/client-cloudwatch": "^3.734.0",
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
22
Reproduction Steps
Pass a number in Timestamp field for PutMetricData
Observed Behavior
Fails
Expected Behavior
Timestamp property accepts ms since 1970
Possible Solution
Allow passing either a Date or number to the Timestamp property.
Additional Information/Context
No response
The text was updated successfully, but these errors were encountered: