Netflix-Skunkworks / aardvark

Aardvark is a multi-account AWS IAM Access Advisor API
Apache License 2.0
471 stars 77 forks source link

Aardvark configuration error #138

Closed wesleivarjaoze closed 2 years ago

wesleivarjaoze commented 2 years ago

I started using Aardvark, and when trying to run the Aardvark config command, I got the following error:

 sys.exit(load_entry_point('aardvark', 'console_scripts', 'aardvark')())
  File "/Users/zeuser/other-repos/aardvark/env/bin/aardvark", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/local/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/metadata.py", line 86, in load
    module = import_module(match.group('module'))
  File "/usr/local/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/Users/zeuser/other-repos/aardvark/aardvark/__init__.py", line 10, in <module>
    from flask_sqlalchemy import SQLAlchemy
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask_SQLAlchemy-2.5.1-py3.9.egg/flask_sqlalchemy/__init__.py", line 14, in <module>
    from flask import _app_ctx_stack, abort, current_app, request
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask-1.0.2-py3.9.egg/flask/__init__.py", line 19, in <module>
    from jinja2 import Markup, escape
ImportError: cannot import name 'Markup' from 'jinja2' (/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Jinja2-3.1.2-py3.9.egg/jinja2/__init__.py)

I got the same error both when using it on a local machine and when doing the procedure through docker compose

wesleivarjaoze commented 2 years ago

Hello,

I managed to fix this error with two dependencies that I listed in that MR: https://github.com/Netflix-Skunkworks/aardvark/pull/139

Until the aadvark update step, I can do it without any kind of problem. But when I go to launch the API and try to access the data at http://localhost:5000/apidocs/#!, I get the following error:

[2022-08-13 22:40:24 -0300] [29391] [INFO] Starting gunicorn 19.7.1
[2022-08-13 22:40:24 -0300] [29391] [INFO] Listening at: http://0.0.0.0:5000 (29391)
[2022-08-13 22:40:24 -0300] [29391] [INFO] Using worker: sync
/usr/local/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/os.py:1023: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
  return io.open(fd, *args, **kwargs)
[2022-08-13 22:40:24 -0300] [29396] [INFO] Booting worker with pid: 29396
2022-08-13 22:40:35,283 ERROR: Exception on /apispec_1.json [GET] [in /Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask-1.0.2-py3.9.egg/flask/app.py:1758]
Traceback (most recent call last):
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask-1.0.2-py3.9.egg/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask-1.0.2-py3.9.egg/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask_RESTful-0.3.5-py3.9.egg/flask_restful/__init__.py", line 271, in error_router
    return original_handler(e)
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask-1.0.2-py3.9.egg/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask-1.0.2-py3.9.egg/flask/_compat.py", line 35, in reraise
    raise value
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask-1.0.2-py3.9.egg/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask-1.0.2-py3.9.egg/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask-1.0.2-py3.9.egg/flask/views.py", line 88, in view
    return self.dispatch_request(*args, **kwargs)
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask-1.0.2-py3.9.egg/flask/views.py", line 158, in dispatch_request
    return meth(*args, **kwargs)
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/flasgger-0.6.3-py3.9.egg/flasgger/base.py", line 227, in get
    doc_summary, doc_description, doc_swag = parse_docstring(
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/flasgger-0.6.3-py3.9.egg/flasgger/utils.py", line 348, in parse_docstring
    swag = yaml.load(full_doc[line_feed + yaml_sep:])
TypeError: load() missing 1 required positional argument: 'Loader'
2022-08-13 22:40:37,000 ERROR: Exception on /apispec_1.json [GET] [in /Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask-1.0.2-py3.9.egg/flask/app.py:1758]
Traceback (most recent call last):
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask-1.0.2-py3.9.egg/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask-1.0.2-py3.9.egg/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask_RESTful-0.3.5-py3.9.egg/flask_restful/__init__.py", line 271, in error_router
    return original_handler(e)
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask-1.0.2-py3.9.egg/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask-1.0.2-py3.9.egg/flask/_compat.py", line 35, in reraise
    raise value
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask-1.0.2-py3.9.egg/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask-1.0.2-py3.9.egg/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask-1.0.2-py3.9.egg/flask/views.py", line 88, in view
    return self.dispatch_request(*args, **kwargs)
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/Flask-1.0.2-py3.9.egg/flask/views.py", line 158, in dispatch_request
    return meth(*args, **kwargs)
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/flasgger-0.6.3-py3.9.egg/flasgger/base.py", line 227, in get
    doc_summary, doc_description, doc_swag = parse_docstring(
  File "/Users/zeuser/other-repos/aardvark/env/lib/python3.9/site-packages/flasgger-0.6.3-py3.9.egg/flasgger/utils.py", line 348, in parse_docstring
    swag = yaml.load(full_doc[line_feed + yaml_sep:])
TypeError: load() missing 1 required positional argument: 'Loader'

Is this service still supported by your team? Because I'm still starting in Python, and I can't know where I'm going wrong, or if the service no longer works due to broken dependencies.

I would love to use Aardvarek+Ripokid, as it would solve our least privilege problem

Thank you for your attention

patricksanders commented 2 years ago

Hey @wesleivarjaoze, sorry for the trouble and thanks for your troubleshooting efforts! This project and Repokid are not well supported at the moment as our team doesn't have the bandwidth to do much work on them.

One thing you can try is running the develop branch (https://github.com/Netflix-Skunkworks/aardvark/tree/develop). I did a lot of refactoring and upgrading work on that a long time ago, so it at least has more modern dependencies and Python version support.

wesleivarjaoze commented 2 years ago

@patricksanders, I corrected the problems and redid my MR, and the errors occurred in the versions of Jinja2, itsdangerous and Flasgger. If you can approve, I would be very grateful!

patricksanders commented 2 years ago

Awesome, done! Thanks for the fix. I'll get a release cut shortly.

patricksanders commented 2 years ago

As soon as I fix the build on the master branch. 😒

wesleivarjaoze commented 2 years ago

Thank you @patricksanders ! :-)