You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using miliseconds to define the expiry of a cloudfront signed url, i.e. specifying dateLessThan, the cloudfront signer throws
Error: dateLessThan is invalid. Ensure the date string is compatible with the Date constructor.
Expected Behavior
Milliseconds should be accepted as they are accepted by the Date constructor This works in SDK v2 and breaks when upgrading from SDK v2 to SDK v3
Current Behavior
The cloudfront signer throws the above mentioned error because it uses Date.parse and not new Date()
However it is perfectly valid to call the Date constructor with a value in miliseconds
newDate(1000000000000)// Sun Sep 09 2001 03:46:40 GMT+0200
Change the error message to Ensure the date string is compatible with Date.parse() - note that this would be breaking from SDK v2 and needs to be added to Upgrading Guide
Handle milliseconds correctly (swap Date.parse() with new Date()? unsure if it breaks formats accepted by Date.parse but then it would at least align with docs)
Additional Information/Context
No response
SDK version used
3.451.0
Environment details (OS name and version, etc.)
not applicable
The text was updated successfully, but these errors were encountered:
darioackermann
changed the title
Misleading error message from cloudfront-signer (Date constructor)
cloudfront-signer no longer accepts milliseconds for dateLessThan / dateGreaterThan
Nov 29, 2023
This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
Describe the bug
When using miliseconds to define the expiry of a cloudfront signed url, i.e. specifying
dateLessThan
, the cloudfront signer throwsExpected Behavior
Milliseconds should be accepted as they are accepted by the Date constructor
This works in SDK v2 and breaks when upgrading from SDK v2 to SDK v3
Current Behavior
The cloudfront signer throws the above mentioned error because it uses
Date.parse
and notnew Date()
However it is perfectly valid to call the Date constructor with a value in miliseconds
However
Date.parse
does not support millisecondsReproduction Steps
Call
Possible Solution
Either of this would suffice
Ensure the date string is compatible with Date.parse()
- note that this would be breaking from SDK v2 and needs to be added to Upgrading GuideDate.parse()
withnew Date()
? unsure if it breaks formats accepted byDate.parse
but then it would at least align with docs)Additional Information/Context
No response
SDK version used
3.451.0
Environment details (OS name and version, etc.)
not applicable
The text was updated successfully, but these errors were encountered: