Skip to content

Redis hook with ssl fails instantiate Redis client #36552

@shohamy7

Description

@shohamy7

Apache Airflow Provider(s)

redis

Versions of Apache Airflow Providers

apache-airflow-providers-redis==3.5.0 (latest)

Apache Airflow version

2.8.0

Operating System

Debian GNU/Linux

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

What happened

When trying to use the RedisHook with SSL, the Redis client fails to instantiate due to misconfiguration of the ssl_cert_file which is not exist in the python redis library.
Instead it should be ssl_certfile, you can click here to see an examle in the redis docs.

When instantiating a RedisHook with SSL, the following error occurs:
Screen Shot 2024-01-03 at 14 11 21

The task obviously fails after this exception.
Full logs here:
dag_id=dummy_redis_run_id=manual__2024-01-03T09_14_02+00_00_task_id=dummy_redis_task_attempt=1.log

What you think should happen instead

The RedisHook instantiation should work with SSL.

How to reproduce

To reproduce do the following:

  1. Create the following connection:
Screen Shot 2024-01-03 at 14 23 22

You can copy the extra from here:

{
  "db": 0,
  "ssl": true,
  "ssl_cert_reqs": "required",
  "ssl_cert_file": "/tmp",
  "ssl_check_hostname": false
}
  1. Run the following DAG:
from datetime import datetime, timedelta
from airflow import DAG
from airflow.providers.redis.operators.redis_publish import RedisPublishOperator

default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'start_date': datetime(2023, 1, 1),
    'email_on_failure': False,
    'email_on_retry': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),
}

with DAG(
    'dummy_redis',
    default_args=default_args,
    schedule=None, 
) as dag:
    dummy_redis = RedisPublishOperator(
        task_id="dummy_redis_task",
        channel="dummy",
        message="hello",
        redis_conn_id="test_redis",
    )
  1. Run the DAG and wait for it to fail.

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions