manugarri opened a new issue, #28936:
URL: https://github.com/apache/airflow/issues/28936
### Apache Airflow version
Other Airflow 2 version (please specify below)
### What happened
Happening on AWS MWAA 2.4.3
I tried logging to the UI (via AWS SSO) and get the error **Internal Server
Error**.
Checking the scheduler logs on Cloudwatch I see the error is afecting the
webserver:
```
| 2023-01-14T09:52:41.611+00:00 | [2023-01-14 09:52:40 +0000] [632]
[ERROR] Error handling request /aws_mwaa/aws-console-sso?login=true
-- | -- | --
| 2023-01-14T09:52:41.621+00:00 | Traceback (most recent call last):
| 2023-01-14T09:52:41.629+00:00 | File
"/usr/local/airflow/.local/lib/python3.10/site-packages/flask/app.py", line
2524, in wsgi_app
| 2023-01-14T09:52:41.638+00:00 | ctx.push()
| 2023-01-14T09:52:41.648+00:00 | File
"/usr/local/airflow/.local/lib/python3.10/site-packages/flask/ctx.py", line
375, in push
| 2023-01-14T09:52:41.659+00:00 | self.session =
session_interface.open_session(self.app, self.request)
| 2023-01-14T09:52:41.670+00:00 | File
"/usr/local/airflow/.local/lib/python3.10/site-packages/flask_session/sessions.py",
line 535, in open_session
| 2023-01-14T09:52:41.679+00:00 | if saved_session and
saved_session.expiry <= datetime.utcnow():
| 2023-01-14T09:52:41.689+00:00 | TypeError: '<=' not supported between
instances of 'NoneType' and 'datetime.datetime'
| 2023-01-14T09:52:41.699+00:00 |
| 2023-01-14T09:52:41.710+00:00 | During handling of the above exception,
another exception occurred:
| 2023-01-14T09:52:41.722+00:00 |
| 2023-01-14T09:52:41.733+00:00 | Traceback (most recent call last):
| 2023-01-14T09:52:41.742+00:00 | File
"/usr/local/airflow/.local/lib/python3.10/site-packages/gunicorn/workers/sync.py",
line 136, in handle
| 2023-01-14T09:52:41.754+00:00 | self.handle_request(listener, req,
client, addr)
| 2023-01-14T09:52:41.764+00:00 | File
"/usr/local/airflow/.local/lib/python3.10/site-packages/gunicorn/workers/sync.py",
line 179, in handle_request
| 2023-01-14T09:52:41.776+00:00 | respiter = self.wsgi(environ,
resp.start_response)
| 2023-01-14T09:52:41.788+00:00 | File
"/usr/local/airflow/.local/lib/python3.10/site-packages/flask/app.py", line
2548, in __call__
| 2023-01-14T09:52:41.797+00:00 | return self.wsgi_app(environ,
start_response)
| 2023-01-14T09:52:41.808+00:00 | File
"/usr/local/airflow/plugins/aws_mwaa/iam.py", line 30, in __call__
| 2023-01-14T09:52:41.822+00:00 | return self.app(environ, start_response)
| 2023-01-14T09:52:41.834+00:00 | File
"/usr/local/airflow/.local/lib/python3.10/site-packages/werkzeug/middleware/proxy_fix.py",
line 187, in __call__
| 2023-01-14T09:52:41.844+00:00 | return self.app(environ, start_response)
| 2023-01-14T09:52:41.853+00:00 | File
"/usr/local/airflow/.local/lib/python3.10/site-packages/flask/app.py", line
2528, in wsgi_app
| 2023-01-14T09:52:41.862+00:00 | response = self.handle_exception(e)
| 2023-01-14T09:52:41.871+00:00 | File
"/usr/local/airflow/.local/lib/python3.10/site-packages/flask/app.py", line
1724, in handle_exception
| 2023-01-14T09:52:41.881+00:00 | server_error =
self.ensure_sync(handler)(server_error)
| 2023-01-14T09:52:41.892+00:00 | File
"/usr/local/airflow/.local/lib/python3.10/site-packages/airflow/www/views.py",
line 508, in show_traceback
| 2023-01-14T09:52:41.900+00:00 | render_template(
| 2023-01-14T09:52:41.909+00:00 | File
"/usr/local/airflow/.local/lib/python3.10/site-packages/flask/templating.py",
line 147, in render_template
| 2023-01-14T09:52:41.919+00:00 | return _render(app, template, context)
| 2023-01-14T09:52:41.930+00:00 | File
"/usr/local/airflow/.local/lib/python3.10/site-packages/flask/templating.py",
line 128, in _render
| 2023-01-14T09:52:41.939+00:00 | app.update_template_context(context)
| 2023-01-14T09:52:41.950+00:00 | File
"/usr/local/airflow/.local/lib/python3.10/site-packages/flask/app.py", line
994, in update_template_context
| 2023-01-14T09:52:41.964+00:00 | context.update(func())
| 2023-01-14T09:52:41.977+00:00 | File
"/usr/local/airflow/.local/lib/python3.10/site-packages/flask_login/utils.py",
line 407, in _user_context_processor
| 2023-01-14T09:52:41.991+00:00 | return dict(current_user=_get_user())
| 2023-01-14T09:52:42.000+00:00 | File
"/usr/local/airflow/.local/lib/python3.10/site-packages/flask_login/utils.py",
line 372, in _get_user
| 2023-01-14T09:52:42.009+00:00 | current_app.login_manager._load_user()
| 2023-01-14T09:52:42.020+00:00 | File
"/usr/local/airflow/.local/lib/python3.10/site-packages/flask_login/login_manager.py",
line 362, in _load_user
| 2023-01-14T09:52:42.030+00:00 | user_id = session.get("_user_id")
| 2023-01-14T09:52:42.041+00:00 | AttributeError: 'NoneType' object has no
attribute 'get'
```
This issue seems to be tied to [this flask-session active
bug](https://github.com/fengsp/flask-session/issues/67)
### What you think should happen instead
I should be able to login to the Airflow UI
### How to reproduce
I have no idea unfortunately, seems to be an issue when a user logs again
after having a successful login
### Operating System
AWS MWAA
### Versions of Apache Airflow Providers
i think is non applicable.
### Deployment
MWAA
### Deployment details
We had just added a new config variable to the MWAA via [terraform idealo
module](https://registry.terraform.io/modules/idealo/mwaa/aws/latest)
### Anything else
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]