Apache Airflow Provider for OpenFaaS

raw JSON →
3.9.4 verified Fri May 01 auth: no python

The Apache Airflow Provider for OpenFaaS enables integration with OpenFaaS function-as-a-service platform. Version 3.9.4 supports Apache Airflow >=2.10.0 and Python >=3.10. It provides hooks, operators, and sensors to invoke and manage OpenFaaS functions. Release cadence follows Airflow provider updates.

pip install apache-airflow-providers-openfaas
error ModuleNotFoundError: No module named 'airflow.providers.openfaas'
cause Provider package not installed or installed incorrectly (missing dependencies).
fix
Run: pip install apache-airflow-providers-openfaas
error AttributeError: module 'airflow.hooks' has no attribute 'openfaas_hook'
cause Using old import path from Airflow 1.x.
fix
Change import to: from airflow.providers.openfaas.hooks.openfaas import OpenFaasHook
error OSError: [Errno 111] Connection refused for gateway_url
cause OpenFaaS gateway is not running or unreachable at the configured URL.
fix
Verify gateway is running: curl http://<gateway_url>/healthz. Ensure network connectivity and correct port.
breaking Provider versioning changed: versions 2.x and earlier were part of Airflow extras. As of 3.0+, the provider is a separate package and must be installed explicitly. Dependencies on OpenFaaS client library (faas-client) may have breaking changes.
fix Install with pip install apache-airflow-providers-openfaas and update imports to use airflow.providers.openfaas path.
gotcha OpenFaasHook requires explicit 'gateway_url' parameter or environment variable OPENFAAS_GATEWAY_URL. If not set, the hook may default to localhost, causing connection issues.
fix Set the gateway_url argument in operators/hook or set OPENFAAS_GATEWAY_URL environment variable.
deprecated The use of Airflow extras (e.g., pip install apache-airflow[openfaas]) is deprecated for providers. Users should install the provider package directly.
fix Use pip install apache-airflow-providers-openfaas instead.
pip install apache-airflow[openfaas]

Basic DAG invoking an OpenFaaS function. Replace gateway_url and function_name with your deployment details.

from airflow import DAG
from airflow.providers.openfaas.operators.openfaas import OpenFaasInvokeFunctionOperator
from datetime import datetime

with DAG(
    dag_id='openfaas_invoke',
    start_date=datetime(2023, 1, 1),
    schedule_interval=None,
    catchup=False,
) as dag:
    invoke = OpenFaasInvokeFunctionOperator(
        task_id='invoke_function',
        function_name='my-function',
        payload={"key": "value"},
        gateway_url='http://gateway:8080',
    )