Aws-sdk-js: listSecrets: Unexpected key 'Filters' found in params

Created on 1 Sep 2020  路  3Comments  路  Source: aws/aws-sdk-js

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug

    const existingSecrets = await awsSecretManager
      .listSecrets({
        Filters: [
          {
            Key: 'name',
            Values: [secretName],
          },
        ],
        MaxResults: 1,
      })
      .promise()

Gets error:

"message": "Unexpected key 'Filters' found in params",
"code": "UnexpectedParameter",
"time": "2020-09-01T11:17:23.058Z"

Is the issue in the browser/Node.js?
Node.js

If on Node.js, are you running this on AWS Lambda?

Yes

Details of the browser/Node.js version
v12.18.2

SDK version number

"aws-sdk": "2.725.0",

Lambda: NODEJS_12_X

To Reproduce (observed behavior)

See above

Expected behavior

Not error

Screenshots

N/A

Additional context

Notably TypeScript types also match this and docs match this request.

bug response-requested

Most helpful comment

I think support for filters on ListSecrets was only added in 2.713.0.

I know you said you're using 2.725.0 but could you just double-check you're definitely using the version you think you are and not a version earlier than 2.713.0?

All 3 comments

I think support for filters on ListSecrets was only added in 2.713.0.

I know you said you're using 2.725.0 but could you just double-check you're definitely using the version you think you are and not a version earlier than 2.713.0?

If you are using the SDK in AWS Lambda, you are likely using old SDK version too. AWS Lambda bundled SDK version is shown in this document.
You can import the latest version of SDK by following these guidelines.

Yeah, using it inside Lambda and I am explicitly ignoring the aws-sdk from the bundle.

So I guess it is using 2.721.0 as per the doc linked.

I have changed my code to use describe, instead of list. As I just needed to check if a secret exists.

Thanks. I guess it can be closed, as it is well explained.

Was this page helpful?
0 / 5 - 0 ratings