Skip to content

dbt-cloud test_connection giving 400 response code #58941

Closed

Description

@gunjisairevanth

Apache Airflow Provider(s)

dbt-cloud

Versions of Apache Airflow Providers

While testing the DBT connection through Airflow → Connections, we found that the request is returning a 400 response code.

{
  "message": "400:Bad Request",
  "status": false
}

Image

dbt provider version
apache-airflow-providers-dbt-cloud==3.11.2

Apache Airflow version

2.10.4

Operating System

Debian GNU/Linux 12 (bookworm)

Deployment

Docker-Compose

Deployment details

Please find attached the Docker Compose file and the requirements I used

docker-compose.yml

requirements.txt

.env

AIRFLOW_UID=50000
_AIRFLOW_WWW_USER_USERNAME=airflow
_AIRFLOW_WWW_USER_PASSWORD=airflow
_PIP_ADDITIONAL_REQUIREMENTS=apache-airflow-providers-dbt-cloud==3.11.2

What happened

When creating the DBT connection in Airflow > Connection and clicking the Test button, it displays a 400: Bad Request error even though the credentials are valid.

Image

While reviewing the test_connection method in DbtCloudHook, I noticed that it calls self._run_and_get_response() without passing any parameters. https://github.com/apache/airflow/blob/providers-dbt-cloud/3.11.2/providers/src/airflow/providers/dbt/cloud/hooks/dbt.py#L718C18-L718C39

    def test_connection(self) -> tuple[bool, str]:
        """Test dbt Cloud connection."""
        try:
            self._run_and_get_response() # <= Here it's calling without endpoint  parameters
            return True, "Successfully connected to dbt Cloud."
        except Exception as e:
            return False, str(e)

As a result, full_endpoint becomes None, causing the dbt API request to be sent with only the host URL and no valid endpoint, which leads to the request failing

curl --location 'https://XXXXX.us1.dbt.com/' \
--header 'Authorization: Token XXXXXX' \
--header 'Content-Type: application/json'
Image

What you think should happen instead

When we add the default endpoint, we receive a 200 response code. So adding the endpoint parameter to _run_and_get_response in test_connection will fix the isssue

curl

curl --location 'https://XX.us1.dbt.com/api/v2/accounts/' \
--header 'Authorization: Token XXX' \
--header 'Content-Type: application/json'
Image

How to reproduce

add the apache-airflow-providers-dbt-cloud==3.11.2 in your AF2 requirements.txt, then try creating a connection and clicking the Test button before saving to reproduce the issue.

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added 2 commits that reference this issue on Dec 30, 2025
  2. eladkal commented on Jun 25, 2026

    @eladkal
    Contributor

    fixed in #59643

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions