certificate verify failed: unable to get local issuer certificate (_ssl.c:1007) #1139

Closed
opened 2026-02-21 17:30:11 -05:00 by yindo · 8 comments
Owner

Originally created by @heywiorld on GitHub (Feb 29, 2024).

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • Pleas do not modify this template :) and fill in all the required fields.

Dify version

0.5.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

hi team, we write self define tool, but when test return error:[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)

yml content is as follow:

openapi: "3.0.0"
info:
  version: 1.0.0
  title: Webhook Test API
servers:
  - url: https://test.com/n8n
    variables:
      server:
        default: test.com
paths:
  /webhook/93b273e7-4b90-4d19-a8c2-690296e935f8/:
    post:
      summary: Get VT and Threat Book IP result
      operationId: VT and TB
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                ip:
                  type: string
                  description: IP address for the test
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookTestResponse"
      security:
        - ApiKeyAuth: []
components:
  schemas:
    WebhookTestResponse:
      type: object
      properties:
        response_message:
          type: string
          description: Response message from the webhook execution
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      name: x-apikey
      in: header
security:
  - ApiKeyAuth: []

✔️ Expected Behavior

return webhook result.

Actual Behavior

return error:[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)
QQ截图20240301090523

Originally created by @heywiorld on GitHub (Feb 29, 2024). ### Self Checks - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] Pleas do not modify this template :) and fill in all the required fields. ### Dify version 0.5.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce hi team, we write self define tool, but when test return error:[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007) yml content is as follow: ``` openapi: "3.0.0" info: version: 1.0.0 title: Webhook Test API servers: - url: https://test.com/n8n variables: server: default: test.com paths: /webhook/93b273e7-4b90-4d19-a8c2-690296e935f8/: post: summary: Get VT and Threat Book IP result operationId: VT and TB requestBody: required: true content: application/json: schema: properties: ip: type: string description: IP address for the test responses: '200': description: OK content: application/json: schema: $ref: "#/components/schemas/WebhookTestResponse" security: - ApiKeyAuth: [] components: schemas: WebhookTestResponse: type: object properties: response_message: type: string description: Response message from the webhook execution securitySchemes: ApiKeyAuth: type: apiKey name: x-apikey in: header security: - ApiKeyAuth: [] ``` ### ✔️ Expected Behavior return webhook result. ### ❌ Actual Behavior return error:[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007) ![QQ截图20240301090523](https://github.com/langgenius/dify/assets/43668597/5dc002b3-3ca0-4bcd-83b1-784eb28e33ac)
yindo added the 🐞 bug label 2026-02-21 17:30:11 -05:00
yindo closed this issue 2026-02-21 17:30:11 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 29, 2024):

🤖

Hey there, @heywiorld! Fancy seeing you here again. Hope you're doing great! 🚀

The error you're encountering, "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)", typically occurs when Python requests do not trust the SSL certificate of the server you are trying to communicate with. Here are some steps you can take to resolve this issue:

  1. Install Certificates: If you're on macOS, and using the default Python installation, the issue might be that Python is not using the system's certificate store. You can install the certificates by running the Install Certificates.command script found in your Python installation directory (usually /Applications/Python <version>/). This script installs the root certificates and should resolve the SSL error.

  2. Use Certifi Package: For a more cross-platform solution, you can use the certifi package, which Python requests can leverage to validate the SSL certificates.

    • First, install the certifi package using pip:
      pip install certifi
      
    • Then, in your Python code where you make HTTP requests, ensure that you point to the certifi certificate bundle:
      import requests
      import certifi
      
      response = requests.get('https://your-server-url', verify=certifi.where())
      
  3. Manually Specify Certificates: If you have a custom or self-signed certificate, you can manually specify the path to your certificate bundle in the requests you make. This requires you to have a .pem file containing the certificates that Python should trust.

    • Example usage:
      import requests
      
      response = requests.get('https://your-server-url', verify='/path/to/your/certificate.pem')
      
  4. Disable SSL Verification (Not Recommended): As a last resort and not recommended for production use, you can disable SSL certificate verification. This approach is insecure and exposes you to various security vulnerabilities, such as man-in-the-middle attacks.

    • Example of disabling SSL verification:

      import requests
      
      response = requests.get('https://your-server-url', verify=False)
      
    • If you choose this approach, ensure it's only for testing purposes in a controlled environment.

Please note that these are general solutions for dealing with SSL certificate verification problems in Python applications, which should be applicable to your situation with Dify version 0.5.2 hosted via Docker. If you continue to experience issues, please provide more details about your setup and we'll be happy to help further.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot[bot] commented on GitHub (Feb 29, 2024): _🤖_ <!-- Greeting --> Hey there, @heywiorld! Fancy seeing you here again. Hope you're doing great! 🚀 <!-- Answer --> The error you're encountering, "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)", typically occurs when Python requests do not trust the SSL certificate of the server you are trying to communicate with. Here are some steps you can take to resolve this issue: 1. **Install Certificates**: If you're on macOS, and using the default Python installation, the issue might be that Python is not using the system's certificate store. You can install the certificates by running the `Install Certificates.command` script found in your Python installation directory (usually `/Applications/Python <version>/`). This script installs the root certificates and should resolve the SSL error. 2. **Use Certifi Package**: For a more cross-platform solution, you can use the `certifi` package, which Python requests can leverage to validate the SSL certificates. - First, install the `certifi` package using pip: ```bash pip install certifi ``` - Then, in your Python code where you make HTTP requests, ensure that you point to the `certifi` certificate bundle: ```python import requests import certifi response = requests.get('https://your-server-url', verify=certifi.where()) ``` 3. **Manually Specify Certificates**: If you have a custom or self-signed certificate, you can manually specify the path to your certificate bundle in the requests you make. This requires you to have a `.pem` file containing the certificates that Python should trust. - Example usage: ```python import requests response = requests.get('https://your-server-url', verify='/path/to/your/certificate.pem') ``` 4. **Disable SSL Verification (Not Recommended)**: As a last resort and not recommended for production use, you can disable SSL certificate verification. This approach is insecure and exposes you to various security vulnerabilities, such as man-in-the-middle attacks. - Example of disabling SSL verification: ```python import requests response = requests.get('https://your-server-url', verify=False) ``` - If you choose this approach, ensure it's only for testing purposes in a controlled environment. Please note that these are general solutions for dealing with SSL certificate verification problems in Python applications, which should be applicable to your situation with Dify version 0.5.2 hosted via Docker. If you continue to experience issues, please provide more details about your setup and we'll be happy to help further. ## Sources - [en/getting-started/install-self-hosted/README.md](https://github.com/langgenius/dify-docs/blob/main/en/getting-started/install-self-hosted/README.md) - [.devcontainer/Dockerfile](https://github.com/langgenius/dify/blob/main/.devcontainer/Dockerfile) <!-- Dosu Comment Footer --> <details open> <summary> #### About Dosu </summary> This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. </details>
Author
Owner

@takatost commented on GitHub (Mar 1, 2024):

Is the HTTPS certificate correct when accessing the API directly?

@takatost commented on GitHub (Mar 1, 2024): Is the HTTPS certificate correct when accessing the API directly?
Author
Owner

@heywiorld commented on GitHub (Mar 1, 2024):

Is the HTTPS certificate correct when accessing the API directly?

yes

@heywiorld commented on GitHub (Mar 1, 2024): > Is the HTTPS certificate correct when accessing the API directly? yes
Author
Owner

@takatost commented on GitHub (Mar 1, 2024):

Is the HTTPS certificate correct when accessing the API directly?

yes

Hey, could you please provide more details? Such as the provider of the certificate, the type, etc. It would help us to reproduce the issue.

@takatost commented on GitHub (Mar 1, 2024): > > Is the HTTPS certificate correct when accessing the API directly? > > yes Hey, could you please provide more details? Such as the provider of the certificate, the type, etc. It would help us to reproduce the issue.
Author
Owner

@heywiorld commented on GitHub (Mar 1, 2024):

Is the HTTPS certificate correct when accessing the API directly?

yes

Hey, could you please provide more details? Such as the provider of the certificate, the type, etc. It would help us to reproduce the issue.

think key point is not cert of https://test.com, as error is unable to get local.
certificate for test.com is made by our company, valid.

@heywiorld commented on GitHub (Mar 1, 2024): > > > Is the HTTPS certificate correct when accessing the API directly? > > > > > > yes > > Hey, could you please provide more details? Such as the provider of the certificate, the type, etc. It would help us to reproduce the issue. think key point is not cert of https://test.com, as error is unable to get local. certificate for test.com is made by our company, valid.
Author
Owner

@dosubot[bot] commented on GitHub (Mar 29, 2024):

Hi, @heywiorld

I'm helping the team manage our backlog and am marking this issue as stale. From what I understand, you are encountering an SSL certificate verification error when testing a self-defined tool in a self-hosted Docker environment. The error "SSL: CERTIFICATE_VERIFY_FAILED" occurs when trying to communicate with a server, despite the HTTPS certificate being correct when accessing the API directly. I provided detailed steps to resolve the SSL error, and "takatost" requested more details about the certificate to help reproduce the issue.

Could you please confirm if this issue is still relevant to the latest version of the repository? If it is, please let the team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you!

@dosubot[bot] commented on GitHub (Mar 29, 2024): <!-- Answer --> Hi, @heywiorld I'm helping the team manage our backlog and am marking this issue as stale. From what I understand, you are encountering an SSL certificate verification error when testing a self-defined tool in a self-hosted Docker environment. The error "SSL: CERTIFICATE_VERIFY_FAILED" occurs when trying to communicate with a server, despite the HTTPS certificate being correct when accessing the API directly. I provided detailed steps to resolve the SSL error, and "takatost" requested more details about the certificate to help reproduce the issue. Could you please confirm if this issue is still relevant to the latest version of the repository? If it is, please let the team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you!
Author
Owner

@insistence-essenn commented on GitHub (May 27, 2024):

Hey, how was the issue solved?

@insistence-essenn commented on GitHub (May 27, 2024): Hey, how was the issue solved?
Author
Owner

@valckmir commented on GitHub (May 28, 2024):

@insistence-essenn see my answer here

@valckmir commented on GitHub (May 28, 2024): @insistence-essenn see my answer [here](https://github.com/langgenius/dify/discussions/4600#discussioncomment-9580322)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#1139