Skip to content

SSM DescribeAvailablePatches fails as Patch.Epoch field expects integer, API returns string #7196

@andyhassall-aveva

Description

@andyhassall-aveva

Checkboxes for prior research

Describe the bug

Calling SSM DescribeAvailablePatches with a filter that includes Amazon Linux packages fails as the Epoch field contains a string when the client expects an integer.

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v22.17.0

Reproduction Steps

import { SSMClient, DescribeAvailablePatchesCommand, paginateDescribeAvailablePatches } from "@aws-sdk/client-ssm";

const paginator = paginateDescribeAvailablePatches({ client: new SSMClient({}) }, {
    Filters: [{ Key: "PRODUCT", Values: ["AmazonLinux2.0"] }]
});

for await (const page of paginator) {
    console.log(page.Patches.length);
}

Observed Behavior

An exception is thrown:

$ node index.js 
Debugger listening on ws://127.0.0.1:64162/04342b17-8321-4e27-958b-0323036fbe9d
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Waiting for the debugger to disconnect...
C:\views\ado\andyh\ssm-client-bug-repro\node_modules\@smithy\core\dist-cjs\submodules\serde\index.js:194
  throw new TypeError(`Expected integer, got ${typeof value}: ${value}`);
        ^

TypeError: Expected integer, got string: 0
  Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.
    at expectLong (C:\views\ado\andyh\ssm-client-bug-repro\node_modules\@smithy\core\dist-cjs\submodules\serde\index.js:194:9)
    at expectSizedInt (C:\views\ado\andyh\ssm-client-bug-repro\node_modules\@smithy\core\dist-cjs\submodules\serde\index.js:201:20)
    at expectInt32 (C:\views\ado\andyh\ssm-client-bug-repro\node_modules\@smithy\core\dist-cjs\submodules\serde\index.js:197:30)
    at applyInstruction (C:\views\ado\andyh\ssm-client-bug-repro\node_modules\@smithy\smithy-client\dist-cjs\index.js:611:27)
    at take (C:\views\ado\andyh\ssm-client-bug-repro\node_modules\@smithy\smithy-client\dist-cjs\index.js:579:5)
    at de_Patch (C:\views\ado\andyh\ssm-client-bug-repro\node_modules\@aws-sdk\client-ssm\dist-cjs\index.js:10512:40)
    at C:\views\ado\andyh\ssm-client-bug-repro\node_modules\@aws-sdk\client-ssm\dist-cjs\index.js:10557:12
    at Array.map (<anonymous>)
    at de_PatchList (C:\views\ado\andyh\ssm-client-bug-repro\node_modules\@aws-sdk\client-ssm\dist-cjs\index.js:10556:58)
    at Patches (C:\views\ado\andyh\ssm-client-bug-repro\node_modules\@aws-sdk\client-ssm\dist-cjs\index.js:9646:44) {
  '$metadata': {
    httpStatusCode: 200,
    requestId: '00fad527-1e0d-44b5-89dc-40b26c00fe4c',
    extendedRequestId: undefined,
    cfId: undefined,
    attempts: 1,
    totalRetryDelay: 0
  }
}

Node.js v22.17.0

Expected Behavior

The list of available patches is returned and iterated through.

Possible Solution

See:

Patching this locally in the installed client in node_modules\@aws-sdk\client-ssm\dist-cjs\index.js, changing here from:

    Epoch: import_smithy_client.expectInt32,

to

    Epoch: import_smithy_client.expectString,

...produces the results expected.

Querying from AWS CLI shows Epoch is a string not an int:

$ aws ssm describe-available-patches --filters Key=PRODUCT,Values=AmazonLinux2018.03 Key=NAME,Values=nginx --max-items 1
{
    "Patches": [
        {
            "ReleaseDate": "1970-01-01T00:00:00+00:00",
            "Product": "AmazonLinux2018.03",
            "Classification": "",
            "AdvisoryIds": [],
            "BugzillaIds": [],
            "CVEIds": [],
            "Name": "nginx",
            "Epoch": "1",
            "Version": "1.12.1",
            "Release": "1.33.amzn1",
            "Arch": "x86_64",
            "Severity": "",
            "Repository": "Main"
        }
    ],
    "NextToken": "eyJOZXh0VG9rZW4iOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAxfQ=="
}

Additional Information/Context

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.closed-for-stalenessp3This is a minor priority issueresponse-requestedWaiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.service-apiThis issue is due to a problem in a service API, not the SDK implementation.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions