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
The _custom_decoder in cache.py converts any date string to a datetime object after it is read from the cache. This change was introduced as part of #2643
def _custom_decoder(json_dict: Dict[str, Any]) -> Dict[str, Any]:
for k, v in json_dict.items():
try:
json_dict[k] = datetime.fromisoformat(v)
continue
except (TypeError, ValueError):
pass
Expected behavior
The object should be stored and retrieved without converting the date string to a datetime object.
Potential fix
Store any date string with a prefix like we do when storing bytes or ObjectId so that they are not converted to datetime objects after being read from the cache.
Additional context
This issue has the potential to affect SaaS erasure requests since we can't build a valid payload to update a collection after the access request data has been stored and retrieved from the cache. TypeError: Object of type datetime is not JSON serializable
The text was updated successfully, but these errors were encountered:
Bug Description
A date string such as
2001-11-08
is converted to a datetime object after being stored and retrieved from the Redis cache.Steps to Reproduce
This is easily reproduced by this test
Root cause
The
_custom_decoder
incache.py
converts any date string to a datetime object after it is read from the cache. This change was introduced as part of #2643Expected behavior
The object should be stored and retrieved without converting the date string to a datetime object.
Potential fix
Store any date string with a prefix like we do when storing
bytes
orObjectId
so that they are not converted to datetime objects after being read from the cache.Additional context
This issue has the potential to affect SaaS erasure requests since we can't build a valid payload to update a collection after the access request data has been stored and retrieved from the cache.
TypeError: Object of type datetime is not JSON serializable
The text was updated successfully, but these errors were encountered: