API Timeout Issue in a Self-Hosted Web Workflow
Self Checks
- [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [x] Please do not modify this template :) and fill in all the required fields.
Dify version
0.15.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
Description
I’ve deployed the Dify project on my server and tried using the HTTP module in workflows to add content to the knowledge base through an API. While API calls work seamlessly with curl on the server and terminal, identical requests via Dify's HTTP module consistently result in timeouts.
Despite numerous tests and troubleshooting attempts, the problem remains unresolved. Any advice or solutions would be greatly appreciated.
Symptoms Observed
-
Server-side, Code, and Terminal Tests:
-
API requests tested with the
curlcommand on the server terminal respond as expected:Outcome: Successfully returned a response.
-
-
HTTP Module in Dify Workflows:
- API calls result in timeouts, typically showing extended connection waits before failing.
-
Additional Notes:
- HTTPS and reverse proxy configurations are correctly enabled in the Nginx setup.
Troubleshooting Steps Taken
-
Validated API Functionality:
- API requests using local IP (
127.0.0.1) and domain names returned expected results. - Verified the service is bound to
0.0.0.0and its ports are externally accessible.
- API requests using local IP (
-
Redirection and HTTPS Tests:
- Checked for potential issues with HTTP-to-HTTPS redirections.
- Used the
--locationparameter incurltests, and all redirections completed without issue.
-
CORS Configuration Review:
- Confirmed the following headers are included in the Nginx configuration:
add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type'; - This did not resolve the timeout issue on the web front.
- Confirmed the following headers are included in the Nginx configuration:
-
Network Environment Validation:
- Ensured the client can resolve the domain to the server’s public IP.
- Used
pingandcurlto confirm that domain resolution and connectivity are operational.
-
Browser Developer Tools:
- Network panel logs show no evident 3xx redirections.
- The primary issue reported is a connection timeout.
✔️ Expected Behavior
Expected Outcome
- The HTTP module in workflows should perform API calls successfully and return proper responses.
❌ Actual Behavior
No response
Hey @MILKMILKKING! 👋 I'm here to help you with your bug report and answer any questions you have. Let's squash those bugs together!
There are a few similar discussions and issues related to HTTP request timeouts in self-hosted Dify environments that might be helpful:
-
Node HTTP Request run failed: Reached maximum retries (3) for URL - This discussion is still open and might provide insights into similar timeout issues [1].
-
HTTP Request utility does not work (timeout) on a self-hosted environment - This closed issue suggests increasing the
GUNICORN_TIMEOUTenvironment variable to 360 seconds in thedocker-compose.yamlfile and removing theSSRF_PROXY_HTTP_URLandSSRF_PROXY_HTTPS_URLenvironment variables from the API container as potential solutions [2].
Additionally, the default timeout for HTTP requests in Dify's workflow module is 15 seconds, which might be causing the issue if the requests take longer than this duration [3].
You might want to try adjusting the timeout settings and checking the environment variables as suggested in the closed issue.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other
I think I met the very similiar issue with you. I need to call workflow API in Dify. The API call works normally if the API call is from another Dify server, however, if the workflow API is from app in the same Dify workspace, it fails each time with "Max try (3) failure".
I hope Dify team can fix this issue.
My Dify environment is 0.13.2.
Hey @takatost, the user @ddnoodle is still experiencing issues with the workflow API in Dify, specifically encountering a "Max try (3) failure" when the API call is made from the same workspace. Could you please assist them with this?
By the way, the chatflow API call work normally both from same server and different server, only the workflow API has such issue in my case.
Hi, @MILKMILKKING. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.
Issue Summary
- You are experiencing API timeout issues with the HTTP module in Dify workflows on a self-hosted server.
- API calls using
curlare successful, indicating correct configurations. - I suggested checking similar issues and adjusting timeout settings and environment variables.
- User ddnoodle reported a similar issue with workflow API calls failing with "Max try (3) failure".
- I have requested further assistance from takatost to address these issues.
Next Steps
- Please confirm if this issue is still relevant to the latest version of the Dify repository by commenting here.
- If there is no further activity, this issue will be automatically closed in 15 days.
Thank you for your understanding and contribution!