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.listDocuments Filters not working for custom key/value pairs

See original GitHub issue

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

Describe the bug A clear and concise description of what the bug is.

ssm.listDocuments Filters is not returning results when filtering on a custom key/value pair. For example, when filtering on: Key=tag:tagName,Values=valueName, (replacing tagName and valueName with the appropriate values) no results are returned. When running the same listDocuments command via the CLI, with the same filters, the expected results are returned.

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 Paste output of npx envinfo --browsers or node -v

AWS_Lambda_nodejs12.x

SDK version number

SDK VERSION 2.804.0

To Reproduce (observed behavior) Steps to reproduce the behavior (please share code or minimal repo)

  1. Create an SSM document and add the tag key: ‘Project’, value: ‘SSM’.
  2. Create a Lambda function with the appropriate IAM permissions (Systems Manager : ListDocuments):
var AWS = require("aws-sdk");
var ssm = new AWS.SSM();
exports.handler = function(event, context, callback) {
    var params = {
        Filters: [
        {
            Key: 'tag:Project',
            Values: [
                'SSM'
            ]
        }
        ] 
    }; 
ssm.listDocuments(params, function(err, data) {
    if (err) console.log(err, err.stack); // an error occurred
    else     console.log(data);           // successful response
});
};
  1. Test the Lambda function

Expected behavior A clear and concise description of what you expected to happen.

The listDocuments function should return an object with a list of the SSM Documents created in Step 1 via the DocumentIdentifiers property.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
awsjoshcommented, Feb 25, 2021

Hi @ajredniwja, since the expected behavior is for this filtering by custom tag to work, and since it does work in the CLI (screenshot attached) - I do believe this needs to be reopened and fixed in all SDKs. The documentation provides examples for this scenario, so customers expect this to work. The SDKs will need to be consistent with the expected behavior provided in the documentation and with the CLI.

Screen Shot 2021-02-25 at 7 20 54 AM cli
0reactions
ajredniwjacommented, Feb 25, 2021

@awsjosh closing this issue as the results were consistent to other SDKs.

Please reach out if you have any questions or you feel differently.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ListDocuments - AWS Systems Manager - AWS Documentation
Returns all Systems Manager (SSM) documents in the current AWS account and AWS Region. You can limit the results of this request by...
Read more >
DocumentKeyValuesFilter (AWS SDK for Java - 2.17.281)
aws ssm list-documents --filters Key=Name,Values=Te ... To specify a custom key-value pair, use the format Key=tag:tagName,Values=valueName .
Read more >
rusoto_ssm - Rust - Docs.rs
To specify a custom key and value pair, use the format Key=tag:tagName,Values=valueName ... aws ssm list-documents --filters Key=tag:region,Values=east,west ...
Read more >
Arguments for method ListDocuments on Paws - MetaCPAN
Arguments for method ListDocuments on Paws::SSM. ... Instead, use Filters . ... To specify a custom key-value pair, use the format Key=tag:tagName ...
Read more >
Returns all Systems Manager (SSM) documents in the current...
ssm_list_documents(DocumentFilterList, Filters, MaxResults, NextToken) ... To specify a custom key-value pair, use the format ⁠Key=tag:tagName ...
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