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

HTTP 500 errors after upgrading to Flask 2.3.0 #222

Closed
asjohnston-asf opened this issue Sep 8, 2023 · 0 comments · Fixed by #291
Closed

HTTP 500 errors after upgrading to Flask 2.3.0 #222

asjohnston-asf opened this issue Sep 8, 2023 · 0 comments · Fixed by #291

Comments

@asjohnston-asf
Copy link
Member

Download requests fail with HTTP 500 responses after upgrading to Flask >= 2.3.0. The traceback is:

[ERROR] AttributeError: 'Flask' object has no attribute 'before_first_request'
Traceback (most recent call last):
  File "/var/lang/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 "/var/task/door/__init__.py", line 5, in <module>
    from door import routes  # noqa Has to be at end of file or will cause circular import
  File "/var/task/door/routes.py", line 28, in <module>
    @app.before_first_request

app.before_first_request was deprecated in Flask 2.2.0 and removed in Flask 2.3.0.

Our app uses before_first_request at https://github.com/asfadmin/grfn-distribution/blob/test/door/src/door/routes.py#L28 to fetch a private key from secrets manager once when the app is initialized. We'll need to refactor where that initialization is done, or pursue #204 which eliminates the need for the private key.

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