You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "JardaCoder (via GitHub)" <gi...@apache.org> on 2023/05/16 20:42:24 UTC
[GitHub] [airflow] JardaCoder opened a new issue, #31330: Connection problem with apache-airflow-providers-apache-kafka
JardaCoder opened a new issue, #31330:
URL: https://github.com/apache/airflow/issues/31330
### Apache Airflow version
Other Airflow 2 version (please specify below)
### What happened
Hello, I'm using airflow version 2.5.1 and I'm not able to create a connection with kafka. I tried in a few ways and it just returns an empty error. For testing purposes, I used the https://kafka-python.readthedocs.io/en/master/ library and had no problem establishing a connection.

### What you think should happen instead
_No response_
### How to reproduce
- Execute the docker-compose file
- Login with username/password airflow/airflow
- Try create a apache kafka connection using docker or some other external one
[airflow-error-simulation.zip](https://github.com/apache/airflow/files/11491863/airflow-error-simulation.zip)
### Operating System
Ubuntu 20.04.5 LTS
### Versions of Apache Airflow Providers
_No response_
### Deployment
Docker-Compose
### 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: commits-unsubscribe@airflow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk closed issue #31330: Connection problem with apache-airflow-providers-apache-kafka
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk closed issue #31330: Connection problem with apache-airflow-providers-apache-kafka
URL: https://github.com/apache/airflow/issues/31330
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] raphaelauv commented on issue #31330: Connection problem with apache-airflow-providers-apache-kafka
Posted by "raphaelauv (via GitHub)" <gi...@apache.org>.
raphaelauv commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-1550486577
airflow is using the lib `confluent-kafka>=1.8.2` for the kafka provider
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] dylanbstorey commented on issue #31330: Connection problem with apache-airflow-providers-apache-kafka
Posted by "dylanbstorey (via GitHub)" <gi...@apache.org>.
dylanbstorey commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-1551397458
Thanks for updating with a new connection. Investigation description seems plausible /likely I'll be able to check in depth in a few days time.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] pauloventurab commented on issue #31330: Connection problem with apache-airflow-providers-apache-kafka
Posted by "pauloventurab (via GitHub)" <gi...@apache.org>.
pauloventurab commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-1558315370
Hello guys, do you have already any answer on that?
I'm using airflow 2.6.1.
connections:
{
"bootstrap.servers": "hide.gcp.confluent.cloud:9092",
"security.protocol": "SASL_SSL",
"sasl.mechanisms": "PLAIN",
"sasl.username": "hide",
"sasl.password": "hide"}
screenshot with error:

--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] JardaCoder commented on issue #31330: Connection problem with apache-airflow-providers-apache-kafka
Posted by "JardaCoder (via GitHub)" <gi...@apache.org>.
JardaCoder commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-1550586732
> docker compose file I think kafka:9092 should work.
Testei dessa forma, até mesmo tentando conecta em um kafka rodando externamente... Mesmo problema.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Connection problem with apache-airflow-providers-apache-kafka [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-2161577548
@riccardoforzan -> can you please open a new issue for it (@dylanbstorey -> It looks like having one base hook of type "kafka" causes it because then BaseKafkaHook is initialized which has "NotImplemented" error - maybe we should have a generric client returned in this case rather than "NotImplemented? ?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] dylanbstorey commented on issue #31330: Connection problem with apache-airflow-providers-apache-kafka
Posted by "dylanbstorey (via GitHub)" <gi...@apache.org>.
dylanbstorey commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-1585427842
@pauloventurab - can you open your comment up as a separate issue please.
Sorry all - i've been AFK for a bit while on a working vacation. I'm home now and able to commit a bit of actual time to this now. Thanks for your patience.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] pauloventurab commented on issue #31330: Connection problem with apache-airflow-providers-apache-kafka
Posted by "pauloventurab (via GitHub)" <gi...@apache.org>.
pauloventurab commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-1563127948
Hello again,
Just to help in something, I think I could manage something using this example dag: https://github.com/apache/airflow/blob/providers-apache-kafka/1.1.0/tests/system/providers/apache/kafka/example_dag_event_listener.py
The only problem is that I can't use the confluent cloud parameters:
```
extra=json.dumps(
{
"bootstrap.servers": "hide.gcp.confluent.cloud:9092",
"security_protocol": "SASL_SSL",
"sasl_mechanism": "PLAIN",
"sasl_plain_username": "hide",
"sasl_plain_password": "hide",
"group.id": "my-group",
"enable.auto.commit": False,
"auto.offset.reset": "earliest",
}
```
Error:
`Traceback (most recent call last):
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/jobs/triggerer_job_runner.py", line 529, in cleanup_finished_triggers
result = details["task"].result()
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/jobs/triggerer_job_runner.py", line 607, in run_trigger
async for event in trigger.run():
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/providers/apache/kafka/triggers/await_message.py", line 91, in run
consumer_hook = KafkaConsumerHook(topics=self.topics, kafka_config_id=self.kafka_config_id)
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/providers/apache/kafka/hooks/consume.py", line 36, in __init__
super().__init__(kafka_config_id=kafka_config_id)
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/providers/apache/kafka/hooks/base.py", line 43, in __init__
self.get_conn
File "/home/airflow/.local/lib/python3.7/site-packages/cached_property.py", line 36, in __get__
value = obj.__dict__[self.func.__name__] = self.func(obj)
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/providers/apache/kafka/hooks/base.py", line 67, in get_conn
return self._get_client(config)
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/providers/apache/kafka/hooks/consume.py", line 40, in _get_client
return Consumer(config)
cimpl.KafkaException: KafkaError{code=_INVALID_ARG,val=-186,str="No such configuration property: "security_protocol""}`
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Connection problem with apache-airflow-providers-apache-kafka [airflow]
Posted by "riccardoforzan (via GitHub)" <gi...@apache.org>.
riccardoforzan commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-2160446273
Hello,
I am encountering an issue with Apache Airflow 2.9.2 when attempting to test a connection to Kafka. I followed the integration guide as per the documentation [here](https://airflow.apache.org/docs/apache-airflow-providers-apache-kafka/stable/index.html). After setting up the connection to Kafka, testing the connection with the command apache airflow connections test <connection-name> results in a failure.
It appears that the test utilizes KafkaBaseHook, and it fails at this specific statement: [base.py#L56](https://github.com/apache/airflow/blob/main/airflow/providers/apache/kafka/hooks/base.py#L56).
Here is the configuration dictionary I am using
```json
{
"bootstrap.servers": "server",
"security.protocol": "SASL_SSL",
"sasl.mechanisms": "PLAIN",
"sasl.username": "username",
"sasl.password": "password"
}
```
Is there a known solution or workaround for this issue?
Thanks
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] pankajkoti commented on issue #31330: Connection problem with apache-airflow-providers-apache-kafka
Posted by "pankajkoti (via GitHub)" <gi...@apache.org>.
pankajkoti commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-1551381055
> > I was able to check this a bit and I believe below mentioned is the cause:
> > The test_connection endpoints calls [test_connection()](https://github.com/apache/airflow/blob/7ebda3898db2eee72d043a9565a674dea72cd8fa/airflow/models/connection.py#L386) which tries to get that hook, In `get_hook()`, the `hook_class` is returned as `airflow.providers.apache.kafka.hooks.base.KafkaBaseHook`, and on [line](https://github.com/apache/airflow/blob/7ebda3898db2eee72d043a9565a674dea72cd8fa/airflow/models/connection.py#L343) when we try to instantiate the hook, it fails on [line](https://github.com/apache/airflow/blob/7ebda3898db2eee72d043a9565a674dea72cd8fa/airflow/providers/apache/kafka/hooks/base.py#L43) as if we check the definition for the property [line](https://github.com/apache/airflow/blob/7ebda3898db2eee72d043a9565a674dea72cd8fa/airflow/providers/apache/kafka/hooks/base.py#L57) raises an Exception. When I commented out [line](https://github.com/apache/airflow/blob/7ebda3898db2eee72d043a9565a674dea72cd8fa/airflow/providers/apache/kafka/hooks/base.py#L43) and
additionally removed the `timeout` parameter from [here](https://github.com/apache/airflow/blob/7ebda3898db2eee72d043a9565a674dea72cd8fa/airflow/providers/apache/kafka/hooks/base.py#L73) as AdminClient does not seem to have that argument, the test connection worked.
>
> So, can we assume it's really a problem with the provider?
I think yes. What do you think @dylanbstorey ?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] JardaCoder commented on issue #31330: Connection problem with apache-airflow-providers-apache-kafka
Posted by "JardaCoder (via GitHub)" <gi...@apache.org>.
JardaCoder commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-1550587954
> Unless the webserver is running in the same service as kafka, local host will not work.
>
> Based on the docker compose file I think kafka:9092 should work.
Sorry, I uploaded the wrong screenshot. I tested it that way, even trying to connect to a kafka running externally... Same problem.

--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk commented on issue #31330: Connection problem with apache-airflow-providers-apache-kafka
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-1551024080
> > Unless the webserver is running in the same service as kafka, local host will not work.
> > Based on the docker compose file I think kafka:9092 should work.
>
> Sorry, I uploaded the wrong screenshot. I tested it that way, even trying to connect to a kafka running externally... Same problem.
>
> 
Is there a log in your webserver you can see with any error ?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] JardaCoder commented on issue #31330: Connection problem with apache-airflow-providers-apache-kafka
Posted by "JardaCoder (via GitHub)" <gi...@apache.org>.
JardaCoder commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-1551347524
> I was able to check this a bit and I believe below mentioned is the cause:
>
> The test_connection endpoints calls [test_connection()](https://github.com/apache/airflow/blob/7ebda3898db2eee72d043a9565a674dea72cd8fa/airflow/models/connection.py#L386) which tries to get that hook, In `get_hook()`, the `hook_class` is returned as `airflow.providers.apache.kafka.hooks.base.KafkaBaseHook`, and on [line](https://github.com/apache/airflow/blob/7ebda3898db2eee72d043a9565a674dea72cd8fa/airflow/models/connection.py#L343) when we try to instantiate the hook, it fails on [line](https://github.com/apache/airflow/blob/7ebda3898db2eee72d043a9565a674dea72cd8fa/airflow/providers/apache/kafka/hooks/base.py#L43) as if we check the definition for the property [line](https://github.com/apache/airflow/blob/7ebda3898db2eee72d043a9565a674dea72cd8fa/airflow/providers/apache/kafka/hooks/base.py#L57) raises an Exception. When I commented out [line](https://github.com/apache/airflow/blob/7ebda3898db2eee72d043a9565a674dea72cd8fa/airflow/providers/apache/kafka/hooks/base.py#L43) and ad
ditionally removed the `timeout` parameter from [here](https://github.com/apache/airflow/blob/7ebda3898db2eee72d043a9565a674dea72cd8fa/airflow/providers/apache/kafka/hooks/base.py#L73) as AdminClient does not seem to have that argument, the test connection worked.
So, can we assume it's really a problem with the provider?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] boring-cyborg[bot] commented on issue #31330: Connection problem with apache-airflow-providers-apache-kafka
Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-1550333133
Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] JardaCoder commented on issue #31330: Connection problem with apache-airflow-providers-apache-kafka
Posted by "JardaCoder (via GitHub)" <gi...@apache.org>.
JardaCoder commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-1551345632
>
> > > Unless the webserver is running in the same service as kafka, local host will not work.
> > > Based on the docker compose file I think kafka:9092 should work.
> >
> >
> > Sorry, I uploaded the wrong screenshot. I tested it that way, even trying to connect to a kafka running externally... Same problem.
> > 
>
> Is there a log in your webserver you can see with any error ?
unfortunately I was not able to catch errors
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] JardaCoder commented on issue #31330: Connection problem with apache-airflow-providers-apache-kafka
Posted by "JardaCoder (via GitHub)" <gi...@apache.org>.
JardaCoder commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-1551344987
>
unfortunately I was not able to catch errors
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] JardaCoder commented on issue #31330: Connection problem with apache-airflow-providers-apache-kafka
Posted by "JardaCoder (via GitHub)" <gi...@apache.org>.
JardaCoder commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-1561886304
> Hello guys, do you have already any answer on that?
>
> I'm using airflow 2.6.1.
>
> connections:
>
> { "bootstrap.servers": "hide.gcp.confluent.cloud:9092", "security.protocol": "SASL_SSL", "sasl.mechanisms": "PLAIN", "sasl.username": "hide", "sasl.password": "hide"}
>
> screenshot with error:
>
> 
using version apache/airflow:2.6.1-python3.10 and provider 1.1.0 I get the same error as you.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] pauloventurab commented on issue #31330: Connection problem with apache-airflow-providers-apache-kafka
Posted by "pauloventurab (via GitHub)" <gi...@apache.org>.
pauloventurab commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-1586302733
You can close this one, I could connect using:
from airflow.utils import db
b.merge_conn(
Connection(
conn_id="kafka_consumer",
conn_type="kafka",
extra=json.dumps(
{
"bootstrap.servers": "server",
"security.protocol": "SASL_SSL",
"sasl.mechanisms": "PLAIN",
"sasl.username": "username",
"sasl.password": "password",
"group.id": "my-group",
"enable.auto.commit": "false",
"auto.offset.reset": "beginning"
}
),
)
)
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk commented on issue #31330: Connection problem with apache-airflow-providers-apache-kafka
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-1550356986
@dylanbstorey - maybe you can take a look?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] dylanbstorey commented on issue #31330: Connection problem with apache-airflow-providers-apache-kafka
Posted by "dylanbstorey (via GitHub)" <gi...@apache.org>.
dylanbstorey commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-1550423597
Unless the webserver is running in the same service as kafka, local host will not work.
Based on the docker compose file I think kafka:9092 should work.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] pankajkoti commented on issue #31330: Connection problem with apache-airflow-providers-apache-kafka
Posted by "pankajkoti (via GitHub)" <gi...@apache.org>.
pankajkoti commented on issue #31330:
URL: https://github.com/apache/airflow/issues/31330#issuecomment-1551161144
I was able to check this a bit and I believe the below is the cause:
The test_connection endpoints calls [test_connection](https://github.com/apache/airflow/blob/7ebda3898db2eee72d043a9565a674dea72cd8fa/airflow/models/connection.py#L386) which tries to get that hook, In get_hook, the `hook_class` is returned as `airflow.providers.apache.kafka.hooks.base.KafkaBaseHook`, and on [line](https://github.com/apache/airflow/blob/7ebda3898db2eee72d043a9565a674dea72cd8fa/airflow/models/connection.py#L343) when we try to instantiate the hook, it fails on [line](https://github.com/apache/airflow/blob/7ebda3898db2eee72d043a9565a674dea72cd8fa/airflow/providers/apache/kafka/hooks/base.py#L43) as if we check the definition for the property [line](https://github.com/apache/airflow/blob/7ebda3898db2eee72d043a9565a674dea72cd8fa/airflow/providers/apache/kafka/hooks/base.py#L57) raises an Exception.
When I commented out [line](https://github.com/apache/airflow/blob/7ebda3898db2eee72d043a9565a674dea72cd8fa/airflow/providers/apache/kafka/hooks/base.py#L43) and additionally removed the `timeout` parameter from [here](https://github.com/apache/airflow/blob/7ebda3898db2eee72d043a9565a674dea72cd8fa/airflow/providers/apache/kafka/hooks/base.py#L73) as AdminClient does not seem to have that argument, the test connection worked.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org