question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ssm describe_instance_patches OverflowError: date value out of range

See original GitHub issue

I am currently looking into boto3 ssm client and calling the describe_instance_patches for a given instance, and i run into the following error: “*** OverflowError: date value out of range”

I have used the boto3 library version: boto3==1.9.42 (This is the same as the default in Lambda. I have also used the latest version: boto3==1.9.203 and this has the same issue. i prefer the 1.9.203 release as this includes pagination for the resposne)

stacktrace.txt

I was able to resolve this on my own machine by changing my environment variable for TZ to UTC:

export TZ="/usr/share/zoneinfo/utc"

I believe this issue happens because Amazon works on UTC, so the timezone on the response is UTC and is being converted to my local timezone, which errors.

Any assistance on this would be ace.

If you want test this yourself (I am assuming you have already got credentials present for boto3):

import boto3
from pprint import pprint


def get_instance_patches(client, instance_id):
    paginator = client.get_paginator("describe_instance_patches")
    for page in paginator.paginate(InstanceId=instance_id):
        for patch in page.get("Patches", []):
            yield patch


def list_instances(client):
    paginator = client.get_paginator("describe_instance_information")
    for page in paginator.paginate():
        for instance in page["InstanceInformationList"]:
            yield instance


if __name__ == "__main__":
    client = boto3.client("ssm")

    for instance in list_instances(client):
        instance_id = instance["InstanceId"]
        for patch in get_instance_patches(client, instance_id):
            pprint(patch)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:24 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
GMael1commented, Feb 3, 2020

Hi, I don’t believe it is fixed, I’m currently using latest versions of botocore and boto3 and facing the exact same issue. @jack1902 could you confirm if you’re still seeing the issue on your side as well ?

1reaction
swetashrecommented, Oct 9, 2019

@jack1902 - This issue occurs only when the service returns negative timestamp. I don’t have any exact time frame but there is already a corresponding CR for it. I will post here when i will get any update from the service side.

Can you please post the logs for CLI ? I am curious to know what is the response you are getting from the service. You can enable the log by adding --debug to your code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

negative timestamp in installed ssm patches list of EC2 instance
negative timestamp in installed ssm patches list of EC2 instance ... _dst_saved))) OverflowError: date value out of range.
Read more >
DescribeInstancePatches - AWS Systems Manager
Retrieves information about the patches on the specified managed node and their state relative to the patch baseline being used for the node....
Read more >
Bug #1752284 “OverflowError: date value out of range”
I first create odt file with libre writer then load it in calibre and launch convert. ... OverflowError: date value out of range....
Read more >
class SSM. Client - Boto3 Docs 1.26.32 documentation - AWS
The default value is 1 . ExpirationDate (datetime) -- The date by which this activation request should expire, in timestamp format, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found