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

   ### Under which category would you file this issue?
   
   Providers
   
   ### Apache Airflow version
   
   2.11.2
   
   ### What happened and how to reproduce it?
   
   In the Snowflake connection form (Add or Edit), clicking **Save** does 
nothing when the newly added **Proxy Port** field is left blank:
   
   - no success banner
   - no flash error
   - no 4xx in the browser network tab
   - the connection is not created or updated
   
   Entering any integer in **Proxy Port** (for example `0` or `8080`) allows 
the form to save successfully.
   
   Root cause:
   
   `SnowflakeHook.get_connection_form_widgets` declares the field as:
   
   ```python
   # providers/snowflake/src/airflow/providers/snowflake/hooks/snowflake.py
   "proxy_port": IntegerField(lazy_gettext("Proxy Port")),
   ```
   
   WTForms `IntegerField` without `Optional()` fails validation on empty input 
because an empty string cannot be coerced to `int`. FAB then silently 
re-renders the form without persisting any changes, which is why the Save 
button appears to do nothing.
   
   Meanwhile the runtime already treats `proxy_port` as optional in 
`SnowflakeHook._get_conn_params`:
   
   ```python
   proxy_port = self._get_field(extra_dict, "proxy_port")
   ...
   if proxy_port:
       conn_config["proxy_port"] = int(proxy_port) if isinstance(proxy_port, 
str) else proxy_port
   ```
   
   So the field is optional by design, and the UI behavior is inconsistent with 
every other code path (CLI, env-var, REST API, secrets backends all accept an 
absent `proxy_port`).
   ```
   
   ### What you think should happen instead?
   
   `Proxy Port` should be optional in the UI, consistent with the other proxy 
fields (`proxy_host`, `proxy_user`, `proxy_password` are all 
`StringField`/`PasswordField` and accept empty input) and with the documented 
optional semantics of `proxy_port`.
   
   Proposed fix: mark the field optional so WTForms short-circuits validation 
for empty input.
   
   ```python
   from wtforms.validators import Optional
   
   "proxy_port": IntegerField(
       lazy_gettext("Proxy Port"),
       widget=BS3TextFieldWidget(),
       validators=[Optional()],
   ),
   ```
   
   ### Operating System
   
   Debian GNU/Linux 12 (bookworm)
   
   ### Deployment
   
   None
   
   ### Apache Airflow Provider(s)
   
   snowflake
   
   ### Versions of Apache Airflow Providers
   
   ```
   apache-airflow-providers-snowflake==6.12.0
   ```
   
   ### Official Helm Chart version
   
   1.15.0
   
   ### Kubernetes Version
   
   1.30
   
   ### Helm Chart configuration
   
   _No response_
   
   ### Docker Image customizations
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [x] 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