I am currently building Airbyte and Airflow on sep...
# replication-troubleshooting
h
I am currently building Airbyte and Airflow on separate machines. I built Airbyte using abctl (Airbyte Control Tool), and Airflow is built on Docker. I access the Airbyte UI from my client PC via port forwarding. I am trying to create an Airbyte connection in Airflow and trigger an Airbyte job using a DAG, but it is failing with an error. What are the required connection settings that I need to configure on the Airflow side?
k
From the docs, there are two slightly different patterns for configuring Airflow to talk to Airbyte, depending on which Airflow provider / guide you follow. In both cases, the key is that Airflow must be able to reach the Airbyte API from inside the Airflow container, not from your client PC. Because you’re running Airbyte and Airflow on different machines and accessing Airbyte via port forwarding from your client, you must set the Host and Port in the Airflow connection to whatever address/port the Airflow container can use to reach the Airbyte API (this will not be your client’s localhost). Below are the required settings as documented; you’ll need to adapt the
Host
to your network. --- ## 1. Using the “HTTP” connection type (per Airbyte docs) In the official operator guide, Airflow uses an HTTP connection that points to the Airbyte API. [[Create DAG guide](https://docs.airbyte.com/platform/operator-guides/using-the-airflow-airbyte-operator#2-create-a-dag-in-apache-airflow-to-trigger-your-airbyte-job)] In Airflow UI: 1. Go to Admin → Connections → +. 2. Set: - Conn Id: e.g.
airbyte_conn_example
- Conn Type:
HTTP
- Host: URL or hostname where Airbyte’s API is reachable from the Airflow container (docs assume
http://localhost:8001
, but in your case this will be the Airbyte machine’s address or a proxy). - Port: Airbyte API port (commonly
8001
for the internal API; check your abctl deployment). - Add auth if your deployment requires it. Then in your DAG:
Copy code
python from airflow import DAG from airflow.utils.dates import days_ago from airflow.providers.airbyte.operators.airbyte import AirbyteTriggerSyncOperator  with DAG(     dag_id='trigger_airbyte_job_example',     default_args={'owner': 'airflow'},     schedule_interval='@daily',     start_date=days_ago(1), ) as dag:      money_to_json = AirbyteTriggerSyncOperator(         task_id='airbyte_money_json_example',         airbyte_conn_id='airbyte_conn_example',  # must match Conn Id above         connection_id='YOUR_AIRBYTE_CONNECTION_ID',         asynchronous=False,         timeout=3600,         wait_seconds=3,     )
[[Create DAG guide](https://docs.airbyte.com/platform/operator-guides/using-the-airflow-airbyte-operator#2-create-a-dag-in-apache-airflow-to-trigger-your-airbyte-job)] You must also ensure
connection_id
is the actual Airbyte connection ID from the Airbyte UI URL. [[Create DAG guide](https://docs.airbyte.com/platform/operator-guides/using-the-airflow-airbyte-operator#2-create-a-dag-in-apache-airflow-to-trigger-your-airbyte-job)] --- ## 2. Using the “Airbyte” connection type (Airflow provider tutorial) The Airflow+Airbyte tutorial uses the Airbyte provider connection type instead of raw HTTP. [[Create Airflow connections](https://airbyte.com/tutorials/how-to-use-airflow-and-airbyte-together)] In Airflow UI: 1. Go to Admin → Connections → +. 2. Set: - Connection Id: e.g.
airflow-call-to-airbyte-example
- Connection Type:
Airbyte
- Host: host where Airbyte is reachable from the Airflow container (in the tutorial they use
host.docker.internal
for local Docker; in your case, use the Airbyte machine’s hostname/IP or a proxy). - Port: Airbyte API port (tutorial uses
8000
for the proxy). [[Create Airflow connections](https://airbyte.com/tutorials/how-to-use-airflow-and-airbyte-together)] - Login: Airbyte username (default
airbyte
if you use the proxy). - Password: Airbyte password (default
password
if you use the proxy). [[Create Airflow connections](https://airbyte.com/tutorials/how-to-use-airflow-and-airbyte-together)] Then in your DAG:
Copy code
python from airflow import DAG from airflow.providers.airbyte.operators.airbyte import AirbyteTriggerSyncOperator from airflow.utils.dates import days_ago  with DAG(     dag_id='trigger_airbyte_job_example',     default_args={'owner': 'airflow'},     schedule_interval='@daily',     start_date=days_ago(1), ) as dag:      trigger_airbyte_sync = AirbyteTriggerSyncOperator(         task_id='airbyte_trigger_sync',         airbyte_conn_id='airflow-call-to-airbyte-example',  # must match Connection Id         connection_id='YOUR_AIRBYTE_CONNECTION_ID',         asynchronous=False,         timeout=3600,         wait_seconds=3,     )
[[Airflow DAG example](https://docs.airbyte.com/platform/operator-guides/using-the-airflow-airbyte-operator#2-create-a-dag-in-apache-airflow-to-trigger-your-airbyte-job)] --- ## 3. Common pitfalls in your setup Given your architecture (separate machines, port forwarding from client): - Do not use
localhost
in the Airflow connection
unless Airbyte is running on the same host as the Airflow container. Use the Airbyte server’s IP/hostname as seen from the Airflow Docker host. - If you’re using SSH port forwarding only on your client PC, Airflow (running on another machine) cannot see that tunnel. You need: - A direct network route from the Airflow host to the Airbyte host, or - A reverse tunnel / proxy that is reachable from the Airflow host, and then configure that address in the Airflow connection. - Ensure the port you configure (8000 vs 8001) matches how abctl exposes the Airbyte API. If you can share the exact error message from the failing DAG run, I can help map it to which of these connection fields is likely misconfigured.
h
@kapa.ai I'm getting the following error on Airflow:
ERROR - Task failed with exception source=task loc=task_runner.py:972AirflowException: Expecting value: line 1 column 1 (char 0)
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/task_runner.py", line 920 in run
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/task_runner.py", line 1307 in _execute_task
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/bases/operator.py", line 416 in wrapper
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/airbyte/operators/airbyte.py", line 84 in execute
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/airbyte/hooks/airbyte.py", line 185 in submit_sync_connection
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
File "/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/airbyte/hooks/airbyte.py", line 176 in submit_sync_connection
File "/home/airflow/.local/lib/python3.12/site-packages/airbyte_api/jobs.py", line 102 in create_job
File "/home/airflow/.local/lib/python3.12/site-packages/airbyte_api/jobs.py", line 97 in create_job
File "/home/airflow/.local/lib/python3.12/site-packages/airbyte_api/_hooks/sdkhooks.py", line 41 in before_request
File "/home/airflow/.local/lib/python3.12/site-packages/airbyte_api/_hooks/clientcredentials.py", line 59 in before_request
File "/home/airflow/.local/lib/python3.12/site-packages/airbyte_api/_hooks/clientcredentials.py", line 125 in do_token_request
File "/home/airflow/.local/lib/python3.12/site-packages/requests/models.py", line 980 in json
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
File "/home/airflow/.local/lib/python3.12/site-packages/requests/models.py", line 976 in json
File "/usr/python/lib/python3.12/json/__init__.py", line 346 in loads
File "/usr/python/lib/python3.12/json/decoder.py", line 338 in decode
File "/usr/python/lib/python3.12/json/decoder.py", line 356 in raw_decode
k
A message from kapa.ai
The knowledge sources don’t contain this exact stack trace, but they do show very similar
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
issues in Airbyte and Airflow when the response body is empty or not valid JSON. [[Airflow task failed](https://discuss.airbyte.io/t/1490); [Retently JSONDecodeError](https://discuss.airbyte.io/t/3097)] In your case, the error occurs while the Airbyte provider is trying to obtain an OAuth2 client-credentials token (
clientcredentials.py -> do_token_request
) before calling the Airbyte API: -
airbyte_api/_hooks/clientcredentials.py: do_token_request
-
requests.models.py: json()
-
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
This means: - The token endpoint that the Airbyte provider is calling is not returning valid JSON (likely an empty body or HTML/error page), so
response.json()
fails. - This happens before the actual Airbyte sync call (
jobs.create_job
), so the problem is with authentication configuration for the Airflow → Airbyte connection, not with the Airbyte job itself. From the docs, the required Airflow connection settings are: - Use an HTTP connection (or the Airbyte connection type, depending on your setup) that points to the Airbyte API. [[Using Airbyte operator](https://docs.airbyte.com/platform/operator-guides/using-the-airflow-airbyte-operator#2-create-a-dag-in-apache-airflow-to-trigger-your-airbyte-job); [Airflow connection example](https://airbyte.com/tutorials/how-to-use-airflow-and-airbyte-together)] - Set: - Host: the URL/hostname where the Airbyte API is reachable from inside the Airflow container (not from your client PC). Docs assume
localhost:8001
or
host.docker.internal:8000
in local Docker, but in your case this must be the actual Airbyte machine / proxy. [[Using Airbyte operator](https://docs.airbyte.com/platform/operator-guides/using-the-airflow-airbyte-operator#2-create-a-dag-in-apache-airflow-to-trigger-your-airbyte-job); [Airflow connection to Airbyte](https://airbyte.com/tutorials/how-to-use-airflow-and-airbyte-together)] - Port: the Airbyte API port (commonly
8001
for the internal API, or
8000
if you’re going through the web proxy, depending on your abctl deployment). [[Using Airbyte operator](https://docs.airbyte.com/platform/operator-guides/using-the-airflow-airbyte-operator#2-create-a-dag-in-apache-airflow-to-trigger-your-airbyte-job)] - Login / Password or Auth: must match how your Airbyte instance is secured (basic auth, token, etc.). The tutorial example uses
airbyte
/
password
when going through the proxy. [[Airflow connection to Airbyte](https://airbyte.com/tutorials/how-to-use-airflow-and-airbyte-together)] Given the specific
clientcredentials
stack trace, the most likely causes are: 1. The Airflow connection is pointing to the wrong URL/port, so the token request hits something that doesn’t return JSON (e.g., a 404/HTML page or an SSH port-forward that isn’t visible from the Airflow container). 2. The OAuth2 / client-credentials configuration for the Airflow connection is incorrect, so the token endpoint returns an error page or empty body instead of a JSON token. What you should verify on the Airflow side: 1. In Admin → Connections, open the connection used by
airbyte_conn_id
in your DAG and confirm: -
Host
and
Port
are reachable from inside the Airflow Docker container (you can
curl
that URL from within the container to confirm). [[Airflow connection to Airbyte](https://airbyte.com/tutorials/how-to-use-airflow-and-airbyte-together)] - Auth settings (client ID/secret, scopes, token URL if configured) match your Airbyte deployment’s expectations. 2. Make sure the
connection_id
in your DAG is the correct Airbyte Connection ID from the Airbyte UI URL. [[Using Airbyte operator](https://docs.airbyte.com/platform/operator-guides/using-the-airflow-airbyte-operator#2-create-a-dag-in-apache-airflow-to-trigger-your-airbyte-job)] 3. If possible, run the same token URL that the provider is using with
curl
from inside the Airflow container and check the raw response; if it’s not JSON, that’s exactly what’s causing the
JSONDecodeError
. Because the docs don’t show the exact client-credentials configuration fields for your version of the Airbyte provider, I can’t give the precise form values, but the error clearly indicates: fix the Airflow connection’s auth/URL so that the token endpoint returns valid JSON. If you can share: - The Airflow connection type and its key fields (host, port, auth type), and - How your Airbyte instance is exposed (URL/port, any auth in front of it), I can help you map those to the documented patterns more concretely.
h
@kapa.ai How can I perform a Curl test from within an Airflow container to Airbyte?
k
A message from kapa.ai
You can exec into the Airflow container and run
curl
from there, targeting the Airbyte API URL/port that Airflow should use. The tutorials show this pattern for checking paths/volumes from inside the Airflow scheduler container; you can use the same approach to run
curl
instead of just listing directories. [[Airflow in Docker](https://airbyte.com/tutorials/how-to-use-airflow-and-airbyte-together)] ### 1. Find the Airflow container name On the machine running Airflow:
Copy code
bash docker ps
Identify the scheduler or webserver container (e.g.
airflow-airflow-scheduler-1
). ### 2. Exec into the container
Copy code
bash docker exec -it <AIRFLOW_CONTAINER_NAME> bash # example: # docker exec -it airflow-airflow-scheduler-1 bash
Now you’re inside the Airflow container shell. [[Airflow in Docker](https://airbyte.com/tutorials/how-to-use-airflow-and-airbyte-together)] ### 3. Run a curl test to Airbyte Use the same host/port that you configured in the Airflow connection, but from inside the container. For example, to hit the (older) sync endpoint:
Copy code
bash curl -v -u 'airbyte:password' \   -X POST "http://<AIRBYTE_HOST>:<AIRBYTE_PORT>/api/v1/connections/sync" \   -H "Accept: application/json" \   -H "Content-Type: application/json" \   -d '{"connectionId":"<YOUR_CONNECTION_ID>"}'
The tutorial uses this pattern from the host with `localhost:8000`; you just adapt `<AIRBYTE_HOST>`/`<AIRBYTE_PORT>` to whatever is reachable from the Airflow container. [[Test API with curl](https://airbyte.com/tutorials/how-to-use-airflow-and-airbyte-together)] If the
curl
call from inside the container: - Succeeds (valid JSON response), your networking and auth are OK. - Fails (connection refused, timeout, HTML error page, etc.), that’s the root cause of the Airflow error; adjust the Airflow connection’s host/port/auth to match whatever works in
curl
.
h
@kapa.ai The result of the Curl execution from the Airflow Scheduler to the Airbyte IP is as follows. Is the communication successful? :/opt/airflow$ curl -v http://10.16.8.25:8080 * Uses proxy env variable NO_PROXY == 'localhost,127.0.0.1,postgres,redis,airflow-apiserver,10.16.8.25' * Trying 10.16.8.25:8080... * Connected to 10.16.8.25 (10.16.8.25) port 8080 (#0)
GET / HTTP/1.1
Host: 10.16.8.25:8080
User-Agent: curl/7.88.1
Accept: /
< HTTP/1.1 200 OK < Content-Security-Policy: script-src * 'unsafe-inline'; worker-src 'self' blob:; < Last-Modified: Sun, 07 Dec 2025 053358 GMT < Cache-Control: no-cache, no-store, must-revalidate, max-age=0 < content-type: text/html < date: Sun, 7 Dec 2025 053358 GMT < expires: Sun, 7 Dec 2025 053458 GMT < content-length: 20326 < <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8">