aws-samples / aws-samples/aws-auto-inventory

Scanning GovCloud for all Services Ends in JSON Serialization Error, Truncated Output

Open
#62 4 comments 2 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
255
Forks
41
PR merge metrics
No merged PRs in 30d

Description

- Version: `1.1.1`
- Local OS Version: `Ubuntu 20.04.5 LTS`
- Local chip architecture: `x86_64`
- Reproduces in: `432896750513`

Steps to Reproduce:

1. python3 scan.py -s scan/sample/all_services.json -r us-gov-west-1

`output:`
```
INFO:__main__:Finished processing for region: us-gov-west-1
ERROR:__main__:'us-gov-west-1' generated an exception: Object of type bytes is not JSON serializable
ERROR:__main__:Traceback (most recent call last):
File "scan.py", line 334, in main
json.dump(service_result["result"], f, cls=DateTimeEncoder)
File "/usr/lib/python3.8/json/__init__.py", line 179, in dump
for chunk in iterable:
File "/usr/lib/python3.8/json/encoder.py", line 431, in _iterencode
yield from _iterencode_dict(o, _current_indent_level)
File "/usr/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
yield from chunks
File "/usr/lib/python3.8/json/encoder.py", line 325, in _iterencode_list
yield from chunks
File "/usr/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
yield from chunks
File "/usr/lib/python3.8/json/encoder.py", line 438, in _iterencode
o = _default(o)
File "scan.py", line 44, in default
return super().default(o)
File "/usr/lib/python3.8/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable

Total elapsed time for scanning: 0h:31m:1s
```

Contributor guide

Open the contributing guide

Research direction

Start with scan.py at main's json.dump call around line 334 and the DateTimeEncoder.default method around line 44. Reproduce the issue with the provided python3 scan.py command for us-gov-west-1, then trace the bytes value in service_result["result"]. Done means the GovCloud scan completes without a JSON serialization error and produces the full output.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.