Skip to content

Unable to use a self-signed certificate due to API failing on verify #53493

Closed

Description

@danieldean

Apache Airflow version

3.0.3

If "Other Airflow 2 version" selected, which one?

No response

What happened?

When using Docker with a self-signed certificate all appears to initially be well from the front end but DAGS will never run and eventually get marked as failed. The message in the run log is:

ERROR - Executor reports task instance <...> finished (failed) although the task says it's queued. (Info: None) Was the task killed externally?

Checking container logs shows that the worker is unable to communicate with the API server due to an SSL certificate verification error:

airflow-worker-1 | 2025-07-18 09:21:32.543021 [error] Task execute_workload[73ed6338-5c59-450c-8e6a-284d52e0cf60] raised unexpected: ConnectError('[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate (_ssl.c:1010)') [celery.app.trace]

#50726 mentions this and a possible workaround by assigning alternative names localhost and airflow-apiserver to the self-signed certificate then adding it into the container. I tried this and was unable to get it to work with the same error message.

What you think should happen instead?

I think not working immediately is sensible but there should be a config parameter to disable certificate verification with suitable warning against doing so.

The setup should still work without needing to import the self-signed certificate to get it verified.

How to reproduce

Setup Airflow as per https://airflow.apache.org/docs/apache-airflow/stable/howto/docker-compose/index.html then add SSL with:

AIRFLOW__WEBSERVER__WEB_SERVER_SSL_CERT: <cert>
AIRFLOW__WEBSERVER__WEB_SERVER_SSL_KEY: <key>

Or their equivalent new API versions. Set the below to HTTPS and add -k flag for healthcheck:

        AIRFLOW__CORE__EXECUTION_API_SERVER_URL: 'https://airflow-apiserver:8080/execution/'

            test: ["CMD", "curl", "--fail", "-k", "https://localhost:8080/api/v2/version"]

Start up Airflow, try to run a DAG and check airflow-worker-1 logs.

Operating System

Ubuntu 22.04.5 LTS

Versions of Apache Airflow Providers

Not relevant.

Deployment

Docker-Compose

Deployment details

Compose file as provided with amendments already give. Docker version 28.3.2, build 578ccf6. Nothing else relevant.

Anything else?

Nothing else to add.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added
    kind:bug
    needs-triage
    on Jul 18, 2025
  2. boring-cyborg commented on Jul 18, 2025

    @boring-cyborg

    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.

  3. added
    area:API
    on Jul 18, 2025
  4. added
    affected_version:3.0
    and removed
    needs-triage
    on Jul 19, 2025
  5. Subham-KRLX commented on Jul 20, 2025

    @Subham-KRLX
    Contributor

    Hi, i would like to work on this issue.

  6. danieldean commented on Jul 20, 2025

    @danieldean
    ContributorAuthor

    I took a look at this and see that httpx is used. This issue on httpx is relevant:

    encode/httpx#302

    As it stands there is no way to alter anything via environment variables as httpx uses certifi. It looks like a cert can be added using the verify arguement which would involve code change to the API SDK.

    I managed to get a self-signed certificate working by customising the image and appending it to the certifi bundle.

    I think a good solution would be to have the certificate used for the api-server added to the trust store. This could be done regardless of whether it is self-signed or not and would require no extra config options.

  7. potiuk commented on Jul 20, 2025

    @potiuk
    Member

    Hi, i would like to work on this issue.

    Assigned you @Subham-KRLX .

    I think a good solution would be to have the certificate used for the api-server added to the trust store. This could be done regardless of whether it is self-signed or not and would require no extra config options.

    Yep. An easy way to add the actual self-signed certificate you use would be the best approach. Any setting to "disable" security is a bad idea, and explicitly marking "this certificate is secure" is way better from security point of view.

  8. Subham-KRLX commented on Jul 20, 2025

    @Subham-KRLX
    Contributor

    I am currently working on this issue and looking into the best way to address the certificate verification problem. I will need a bit more time to properly investigate and identify the best solution. Once I pinpoint the root cause i will raise a pr here.

  9. danieldean commented on Jul 20, 2025

    @danieldean
    ContributorAuthor

    @Subham-KRLX appologies if I am stepping on your toes. I did not initially think I would be able to fix this otherwise I would have indicated I could do so.

    I think both methods would work but I have gone with a way that it more succinct and fetches only existing config options.

  10. Subham-KRLX commented on Jul 21, 2025

    @Subham-KRLX
    Contributor

    No problem at all @danieldean! Happy to collaborate or combine ideas if needed.

  11. danieldean commented on Jul 21, 2025

    @danieldean
    ContributorAuthor

    @Subham-KRLX as suggested you could do a unit test for the PR? I am unsure how to do this.

  12. Subham-KRLX commented on Jul 21, 2025

    @Subham-KRLX
    Contributor

    Hi @danieldean I had like to help with this issue and assist in adding unit tests for your PR. Let me know how I can contribute!

  13. Subham-KRLX commented on Jul 25, 2025

    @Subham-KRLX
    Contributor

    I am facing a persistent pre-commit failure in PR #53589 during UI build with error: “packages field missing or empty” when running pnpm config set store-dir .pnpm-store in airflow-core/src/airflow/ui. I have removed the workspaces field from package.json, cleaned node_modules and lockfiles, reinstalled deps, and approved build scripts, but the issue remains locally and in CI. Could you please advise on any other workspace or pnpm configs I should adjust to fix this?

  14. potiuk commented on Jul 26, 2025

    @potiuk
    Member

    I am facing a persistent pre-commit failure in PR #53589 during UI build with error: “packages field missing or empty” when running pnpm config set store-dir .pnpm-store in airflow-core/src/airflow/ui. I have removed the workspaces field from package.json, cleaned node_modules and lockfiles, reinstalled deps, and approved build scripts, but the issue remains locally and in CI. Could you please advise on any other workspace or pnpm configs I should adjust to fix this?

    breeze compile-ui-assets --force-clean
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

affected_version:3.0area:APIarea:coregood first issuekind:bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions