charts: edit connection causes page crash

What is the bug?

When I click on edit connection, I get the following exception:

Something bad has happened.
Please consider letting us know by creating a bug report using GitHub.

Python version: 3.8.10
Airflow version: 2.1.2
Node: airflow-new-web-6784f5c49c-98gg5
-------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/airflow/.local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/airflow/.local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/airflow/.local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/airflow/.local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/airflow/.local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/airflow/.local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/airflow/.local/lib/python3.8/site-packages/flask_appbuilder/security/decorators.py", line 109, in wraps
    return f(self, *args, **kwargs)
  File "/home/airflow/.local/lib/python3.8/site-packages/flask_appbuilder/views.py", line 602, in edit
    widgets = self._edit(pk)
  File "/home/airflow/.local/lib/python3.8/site-packages/flask_appbuilder/baseviews.py", line 1233, in _edit
    form = self.edit_form.refresh(obj=item)
  File "/home/airflow/.local/lib/python3.8/site-packages/flask_appbuilder/forms.py", line 329, in refresh
    form = self(obj=obj)
  File "/home/airflow/.local/lib/python3.8/site-packages/wtforms/form.py", line 208, in __call__
    return type.__call__(cls, *args, **kwargs)
  File "/home/airflow/.local/lib/python3.8/site-packages/flask_wtf/form.py", line 87, in __init__
    super(FlaskForm, self).__init__(formdata=formdata, **kwargs)
  File "/home/airflow/.local/lib/python3.8/site-packages/wtforms/form.py", line 274, in __init__
    self.process(formdata, obj, data=data, **kwargs)
  File "/home/airflow/.local/lib/python3.8/site-packages/wtforms/form.py", line 126, in process
    if obj is not None and hasattr(obj, name):
  File "/home/airflow/.local/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py", line 365, in __get__
    retval = self.descriptor.__get__(instance, owner)
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/models/connection.py", line 262, in get_extra
    return fernet.decrypt(bytes(self._extra, 'utf-8')).decode()
  File "/home/airflow/.local/lib/python3.8/site-packages/cryptography/fernet.py", line 194, in decrypt
    raise InvalidToken
cryptography.fernet.InvalidToken

What version of the chart are you using?:

I am using version 8.5.2

What is your Kubernetes Version?:

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.2", GitCommit:"092fbfbf53427de67cac1e9fa54aaa09a28371d7", GitTreeState:"clean", BuildDate:"2021-06-16T12:59:11Z", GoVersion:"go1.16.5", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"19+", GitVersion:"v1.19.13-eks-8df270", GitCommit:"8df2700a72a2598fa3a67c05126fa158fd839620", GitTreeState:"clean", BuildDate:"2021-07-31T01:36:57Z", GoVersion:"go1.15.14", Compiler:"gc", Platform:"linux/amd64"}

What is your Helm version?:

$ helm version
version.BuildInfo{Version:"v3.5.4", GitCommit:"1b5edb69df3d3a08df77c9902dc17af864ff05d1", GitTreeState:"dirty", GoVersion:"go1.16.3"}

Please copy your custom Helm values file:

airflow:
  config:
    AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: True
    AIRFLOW__CORE__SQL_ALCHEMY_POOL_SIZE: 1000
    AIRFLOW__CELERY__CELERY_CONCURRENCY: 16
    AIRFLOW__CELERY__WORKER_CONCURRENCY: 16
    AIRFLOW__SMTP__SMTP_HOST: mail-relay.some-domain.company.com
    AIRFLOW__SMTP__SMTP_STARTTLS: False
    AIRFLOW__SMTP__SMTP_MAIL_FROM: new-airflow-dev@company.com
    AIRFLOW__SMTP__SMTP_PORT: 1465
    AIRFLOW__SCHEDULER__CATCHUP_BY_DEFAULT: False
    AIRFLOW__SCHEDULER__RUN_DURATION: 21600
    AIRFLOW__WEBSERVER__BASE_URL: http://new-airflow.team-dev.company.com:8080/
    AIRFLOW__SCHEDULER__DAG_DIR_LIST_INTERVAL: 60
    PIP_INDEX_URL: https://some-nexus-url/repository/company-pypi-group/simple
  extraEnv:
    - name: AIRFLOW__CORE__FERNET_KEY
      valueFrom:
        secretKeyRef:
          name: secret-envvars
          key: fernet-key
  variables:
    - key: "environment"
      value: "dev"
    - key: "foo.alert_emails"
      value: "['something@company.com']"
  connections:
    - id: databricks_default
      type: databricks
      token: 123
      host: company.cloud.databricks.com
      extra: '{"host": "company.cloud.databricks.com", "token":"123"}'  
web:
  initialDelaySeconds: 30
  service:
    type: LoadBalancer
    annotations:
      external-dns.alpha.kubernetes.io/hostname: new-airflow.team-dev.company.com
      service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
      service.beta.kubernetes.io/aws-load-balancer-type: nlb  
dags:
  gitSync:
    repo: https://oauth2:123@gitlab.some-domain.company.com/company/team-airflow.git
    branch: dev
    enabled: true
    syncWait: 60
persistence:
  enabled: true
  storageClass: gp2
  size: 10Gi
workers:
  replicas: 2
postgresql:
  postgresqlExtendedConf:
    maxConnections: "1000"

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

Hello Everybody,

Just for people who get to this thread with similar problem. Yesterday we solved the connections list crash issue.

From sql we got all the connections: SELECT conn_id FROM connection;

then for every connection I run: airflow connections get <conn_id>

and for every connection that throws broken output: airflow connections delete <con_id>

After removing all that was broken, airflow connections list and Admin -> Connections from Web UI worked again.