I have wasted hours trying to find out why stepfunctions.listTagsForResource(...)
is not defined when calling it from the AWS Lambda integrated editors like this:
const { tags } = await stepfunctions.listTagsForResource({
resourceArn: process.env.STATE_MACHINE_ARN
}).promise()
lambda.listTags(...)
, however, seems to be available. I feel really stupid asking a question that (seemingly) simple:
How do I access AWS Step Functions resource tags using the AWS SDK? The docs certainly didn't help.
EDIT: It's worth noting that all the other list
functions work as expected, listTagsForResource
is the only one that is not defined.
The version of aws-sdk
available for use in the inline AWS Lambda editor is commonly antiquated; the current version there does not define the listTagsForResource
function.
Right now, running the following in the inline editor shows the aws-sdk
version is 2.290.0
:
var AWS = require("aws-sdk")
exports.handler = async (event) => {
console.log(AWS.VERSION)
}
The latest version at this time (as in your docs link) is 2.409.0
, which does, indeed, define the listTagsForResource
function. You can confirm this in the v2.409.0 source code.
listTagsForResource
was not, unfortunately, available in v2.290.0, so you won't be able to call it in the Lambda inline editor. (It appears that function was added in this commit for v2.382.0.)
It's still possible to use this function in Lambda, just not through the snazzy inline editor--you would have to build a package of your Node app and deploy it to Lambda as a Zip file.
So, your question isn't stupid at all; you've encountered a frustrating problem that all too often bites people wanting to try out something quickly in the inline editor.