langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
43.01k stars 5.97k forks source link

HTTP Request utility does not work (timeout) on a self-hosted environment. #6244

Closed saendu closed 1 month ago

saendu commented 1 month ago

Self Checks

Dify version

0.6.13

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Setup:

  1. Create a workflow
  2. Use a HTTP Request (GET) e.g. https://jsonplaceholder.typicode.com/todos/1
  3. Run the workflow

✔️ Expected Behavior

❌ Actual Behavior

Node HTTP Request run failed: [Errno 110] Connection timed out

image

dosubot[bot] commented 1 month ago

@saendu Hello! I'm here to help you with any bugs, questions, or contributions while you wait for a human maintainer. Let's squash those bugs together!

To resolve the HTTP Request utility timing out in a self-hosted environment using Dify version 0.6.13, you should adjust the GUNICORN_TIMEOUT environment variable. The default value is 200 seconds, but it is recommended to set it to 360 seconds to support long-duration requests.

Here is the relevant configuration:

GUNICORN_TIMEOUT: 360

This setting will increase the timeout duration for request processing, which should help in preventing timeouts for longer HTTP requests. Ensure that this configuration is included in the x-shared-env section of your docker-compose.yaml file to apply it correctly across your environment.

For reference, here is an example from the docker/.env.example file:

# Request handling timeout. The default is 200,
# it is recommended to set it to 360 to support a longer sse connection time.
GUNICORN_TIMEOUT=360

Make sure to update your environment variables accordingly to prevent the HTTP Request utility from timing out [1][2][3].

To continue talking to Dosu, mention @dosu.

crazywoola commented 1 month ago

I guess this is not related to terraform settings.

Maybe you can try to set these 2 variables to blank.

https://github.com/langgenius/dify/blob/079583eaa474e5c26716f093b9a821cad82b80c5/docker/docker-compose.yaml#L267-L268

gijigae commented 1 month ago

@saendu thank you so much for adding the issue! @crazywoola , thanks for the prompt reply! I removed the following two variables from the api container, not from the sandbox and it worked! Didn't need to remove those two variables from the sandbox container. Even though Dify is working now in Azure Container Apps, I would like to know what implication it might have without settings these two proxy in the api container. @crazywoola, hope you can shed some light on the matter.


      env {
        name  = "SSRF_PROXY_HTTP_URL"
        value = "http://ssrfproxy:3128"
      }

      env {
        name  = "SSRF_PROXY_HTTPS_URL"
        value = "http://ssrfproxy:3128"
      }
saendu commented 1 month ago

Hi guys. Thank you so much for the prompt reply. I can confirm that removing SSRF_PROXY_HTTP_URL and SSRF_PROXY_HTTPS_URL from the api container did indeed work.

In the codebase I can see that they are used to avoid SSRF (see ssrf_proxy.py). Would be great if anybody could confirm that is is not necessary when using Azure infrastructure. I guess the ssrfproxy container then would be obsolete.

crazywoola commented 1 month ago

@saendu @gijigae Workflow Timeout In Details.yml.zip These variables confuse me as well, So I made a example workflow with some notes in it. Hope this could help.

image
crazywoola commented 1 month ago

Link https://github.com/langgenius/dify/issues/6304

saendu commented 1 month ago

Not sure if it is related to the ssrf proxy issue, but creating 'knowledge' (embeddings) do also not work.

UPDATE 2: 25.7. Issue resolved again. The above problem was only temporary.

UPDATE 1: My tests showed that creating embeddings is stuck, with or without the SSRF_PROXY_HTTPS_URL variables.

crazywoola commented 1 month ago

Not sure if it is related to the ssrf proxy issue, but creating 'knowledge' (embeddings) do also not work.

UPDATE 2: 25.7. Issue resolved again. The above problem was only temporary.

UPDATE 1: My tests showed that creating embeddings is stuck, with or without the SSRF_PROXY_HTTPS_URL variables.

I guess the embedding server is not responding somehow.