genehynson opened a new issue, #32890:
URL: https://github.com/apache/airflow/issues/32890
### Apache Airflow version
Other Airflow 2 version (please specify below)
### What happened
I have a custom Airflow provider with a custom connection type. We support
providing fields in the `login`/`password` fields or in a json object with keys
`mcd_id` and `mcd_token` in the `extra` field. Here's our code:
```
...
connection = self.get_connection(self.mcd_session_conn_id)
connection_extra = connection.extra_dejson
try:
return Session(
mcd_id=connection.login or connection_extra['mcd_id'],
mcd_token=connection.password or
connection_extra['mcd_token'],
**self._get_session_extra(connection)
)
except KeyError as err:
raise AirflowException(f'Missing expected key {err} from
connection extra.')
```
In Airflow 2.5.2 this works fine. I can provide the fields in the Airflow UI
in either `login`/`password` or `extra` as expected.
However, in Airflow 2.6.1 this stopped working. I can supply the fields in
`login`/`password` but when I provide them in `extra` I now get an error.
<img width="523" alt="image"
src="https://github.com/apache/airflow/assets/6411855/e04a9c1d-cef9-4f56-8e66-96a9413a9268">
Inspecting the web request I see that the `extra` field is empty, even
though I have data in there:
```json
{
"connection_id": "",
"conn_type": "mcd",
"extra": "{}"
}
```
<img width="457" alt="image"
src="https://github.com/apache/airflow/assets/6411855/d6bab951-5d03-4695-a397-8bf6989d93a7">
I can reproduce this issue with the `http` connection type as well.
I saw [this
issue](https://github.com/apache/airflow/issues/31330#issuecomment-1558315370)
which seems related. It was closed because the opener worked around the issue
by creating the connection in code instead of the Airflow UI.
I couldn't find any other issues mentioning this problem.
### What you think should happen instead
The `extra` field should be included in the connection created request.
### How to reproduce
Create an `http` connection in the Airflow UI using at least version 2.6.1.
Put any value in the `extra` field and test the connection while inspecting the
network request. Notice that the `extra` field value is not supplied in the
request.
### Operating System
N/A
### Versions of Apache Airflow Providers
N/A
### Deployment
Astronomer
### Deployment details
_No response_
### 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]