Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use .get() on REQUEST_ID_UNIQUE_VALUE_PREFIX #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

f3ndot
Copy link

@f3ndot f3ndot commented Oct 13, 2021

Direct access to the Flask config when no REQUEST_ID_UNIQUE_VALUE_PREFIX is explicitly set generates a KeyError. Without this pull request you need to do app.config['REQUEST_ID_UNIQUE_VALUE_PREFIX'] = None in order to make the middleware work

...
  File "/usr/src/app/SON/frontend/views.py", line 156, in <module>
    RequestID(app)
  File "/opt/venv/lib/python3.7/site-packages/flask_request_id_header/middleware/__init__.py", line 37, in __init__
    self._unique_request_id_value_prefix = app.config['REQUEST_ID_UNIQUE_VALUE_PREFIX']
KeyError: 'REQUEST_ID_UNIQUE_VALUE_PREFIX'

Copy link

@kajbaf kajbaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'REQUEST_ID_UNIQUE_VALUE_PREFIX' is supposed to be optional. This PR solves the bug which crashes the system if a value prefix is not provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants