Limess opened a new issue, #31014:
URL: https://github.com/apache/airflow/issues/31014

   ### Apache Airflow version
   
   2.6.0
   
   ### What happened
   
   When clicking the "Trigger DAG w/ config" in a DAG UI I receive a 500 "Oops" 
page.
   
   The Airflow webserver logs show this:
   
   ```
   2023-05-02T13:02:50 - [2023-05-02T12:02:50.249+0000] {app.py:1744} ERROR - 
Exception on /trigger [GET]
   2023-05-02T13:02:50 - Traceback (most recent call last):
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/flask/app.py", line 2529, in 
wsgi_app
   2023-05-02T13:02:50 -     response = self.full_dispatch_request()
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/flask/app.py", line 1825, in 
full_dispatch_request
   2023-05-02T13:02:50 -     rv = self.handle_user_exception(e)
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/flask/app.py", line 1823, in 
full_dispatch_request
   2023-05-02T13:02:50 -     rv = self.dispatch_request()
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/flask/app.py", line 1799, in 
dispatch_request
   2023-05-02T13:02:50 -     return 
self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/airflow/www/auth.py", line 
47, in decorated
   2023-05-02T13:02:50 -     return func(*args, **kwargs)
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/airflow/www/decorators.py", 
line 125, in wrapper
   2023-05-02T13:02:50 -     return f(*args, **kwargs)
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/airflow/utils/session.py", 
line 76, in wrapper
   2023-05-02T13:02:50 -     return func(*args, session=session, **kwargs)
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/airflow/www/views.py", line 
1967, in trigger
   2023-05-02T13:02:50 -     return self.render_template(
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/airflow/www/views.py", line 
640, in render_template
   2023-05-02T13:02:50 -     return super().render_template(
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/flask_appbuilder/baseviews.py",
 line 339, in render_template
   2023-05-02T13:02:50 -     return render_template(
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/flask/templating.py", line 
147, in render_template
   2023-05-02T13:02:50 -     return _render(app, template, context)
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/flask/templating.py", line 
130, in _render
   2023-05-02T13:02:50 -     rv = template.render(context)
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/jinja2/environment.py", line 
1301, in render
   2023-05-02T13:02:50 -     self.environment.handle_exception()
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/jinja2/environment.py", line 
936, in handle_exception
   2023-05-02T13:02:50 -     raise rewrite_traceback_stack(source=source)
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/airflow/www/templates/airflow/trigger.html",
 line 106, in top-level template code
   2023-05-02T13:02:50 -     <span class="help-block">{{ 
form_details.description }}</span>
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/airflow/www/templates/airflow/main.html",
 line 21, in top-level template code
   2023-05-02T13:02:50 -     {% from 'airflow/_messages.html' import 
show_message %}
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/flask_appbuilder/templates/appbuilder/baselayout.html",
 line 2, in top-level template code
   2023-05-02T13:02:50 -     {% import 'appbuilder/baselib.html' as baselib %}
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/flask_appbuilder/templates/appbuilder/init.html",
 line 42, in top-level template code
   2023-05-02T13:02:50 -     {% block body %}
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/flask_appbuilder/templates/appbuilder/baselayout.html",
 line 19, in block 'body'
   2023-05-02T13:02:50 -     {% block content %}
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/airflow/www/templates/airflow/trigger.html",
 line 162, in block 'content'
   2023-05-02T13:02:50 -     {{ form_element(form_key, form_details) }}
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/jinja2/runtime.py", line 777, 
in _invoke
   2023-05-02T13:02:50 -     rv = self._func(*arguments)
   2023-05-02T13:02:50 -   File 
"/opt/airflow/.local/lib/python3.10/site-packages/airflow/www/templates/airflow/trigger.html",
 line 83, in template
   2023-05-02T13:02:50 -     {%- for txt in form_details.value -%}
   2023-05-02T13:02:50 - TypeError: 'NoneType' object is not iterable
   ```
   
   ### What you think should happen instead
   
   No error is shown (worked in 2.5.2)
   
   ### How to reproduce
   
   Create a DAG with the following config defined for parameters:
   
   ```
   params={
               "delete_actions": Param(
                   False,
                   description="Whether to delete actions after execution.",
                   type="boolean",
               ),
               "dates": Param(
                   None,
                   description="An explicit list of date strings to run on.",
                   type=["null", "array"],
                   minItems=1,
               ),
               "start_date_inclusive": Param(
                   None,
                   description="An inclusive start-date used to generate a list 
of dates to run on.",
                   type=["null", "string"],
                   pattern="^[0-9]{4}[-/][0-9]{2}[-/][0-9]{2}$",
               ),
               "end_date_exclusive": Param(
                   None,
                   description="An exclusive end-date used to generate a list 
of dates to run on.",
                   type=["null", "string"],
                   pattern="^[0-9]{4}[-/][0-9]{2}[-/][0-9]{2}$",
               ),
               "actions_bucket_name": Param(
                   None,
                   description='An S3 bucket to read batch actions from. Set as 
"ACTIONS_BUCKET".',
                   type=["null", "string"],
               ),
               "actions_path_prefix": Param(
                   None,
                   description='An S3 bucket to read batch actions from. 
Prefixes "ACTIONS_PATH".',
                   type=["null", "string"],
                   pattern="^.+/$",
               ),
               "sns_output_topic_name": Param(
                   None,
                   description='An SNS output topic ARN to set as 
"DATA_READY_TO_INDEX_OUTPUT_TOPIC."',
                   type=["null", "string"],
               ),
           },
           # required to convert params to their correct types
           render_template_as_native_obj=True,
   ```
   
   Deploy the DAG, click the manual trigger button.
   
   ### Operating System
   
   Debian
   
   ### Versions of Apache Airflow Providers
   
   N/A
   
   ### Deployment
   
   Other Docker-based deployment
   
   ### Deployment details
   
   Amazon ECS
   Python version: 3.10.11
   Airflow version: 2.6.0 (official docker image as base)
   
   ### Anything else
   
   Occurs every time.
   
   Does *NOT* occur when `params` are not defined on the DAG.
   
   ### 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]

Reply via email to