ssm.listDocuments Filters not working for custom key/value pairs
See original GitHub issueConfirm by changing [ ] to [x] below to ensure that it’s a bug:
- I’ve gone through Developer Guide and API reference
- I’ve checked AWS Forums and StackOverflow for answers
- I’ve searched for previous similar issues and didn’t find any solution A previous bug report was submitted here: https://github.com/aws/aws-sdk-js/issues/2858
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)
- Create an SSM document and add the tag key: ‘Project’, value: ‘SSM’.
- 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
});
};
- 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:
- Created 3 years ago
- Comments:7 (5 by maintainers)
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.
@awsjosh closing this issue as the results were consistent to other SDKs.
Please reach out if you have any questions or you feel differently.