duo-labs / duo-labs/cloudmapper
Lambda Function Tags - cannot iterate over null
- Dominant language
- JavaScript
- Stars
- 6.3k
- Forks
- 836
- PR merge metrics
- No merged PRs in 30d
Description
**Issue**
When running `prepare` with the `--tags` flag I see
- Error is thrown: `Cannot iterate over null`
**Cause**
The `shared/nodes.py` file, around line 707
```python
@property
def tags(self):
return pyjq.all(".tags", self._json_blob)
```
There is no `.tags` property with the lambda functions in my account-data folder. Since `pyjq.all` returns a list, it ends up returning `[None]`.
At first, I thought maybe filter the list but then realized the API that collects lambda functions uses [ListFunctions](https://docs.aws.amazon.com/lambda/latest/dg/API_ListFunctions.html) which doesn't return the tags for Lambda functions.
The [GetFunction](https://docs.aws.amazon.com/lambda/latest/dg/API_GetFunction.html) API includes tags, but probably the better API to use specifically for getting tags would be [ListTags](https://docs.aws.amazon.com/lambda/latest/dg/API_ListTags.html).
I suppose the problem here would be that to get the tags for lambda functions one would need to list-functions and then iterate over that, calling one of the above API endpoints for each lambda function and then merging the data _(or keeping it separate)_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.