Discrepancy between Dify Cloud API Documentation and Actual Behavior - Response Timeout #10822

Closed
opened 2026-02-21 18:51:32 -05:00 by yindo · 0 comments
Owner

Originally created by @snaka on GitHub (Mar 13, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • 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).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.0.1

Cloud or Self Hosted

Cloud

Steps to reproduce

  1. Create a workflow in Dify that sequentially executes six code blocks.
  2. Each code block contains the following Python code, which simulates a long-running task by sleeping for 10 seconds:
import time

def main() -> dict:
   time.sleep(20)
   return {}

Note: The reason for having six sleep codes of 10 seconds each is that the entire workflow is intended to have a wait time of 60 seconds or more.

  1. Save and publish the workflow you have created.

  2. Execute the created workflow using the following Ruby code:

require 'net/http'
require 'uri'
require 'json'

uri = URI.parse("https://api.dify.ai/v1/workflows/run")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.read_timeout = 300 # 300 sec. = 5 min.

headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer YOUR_API_KEY' # Replace with your actual API key
}

params = { inputs: {}, response_mode: 'blocking', user: "foo" }

response = http.post(uri.path, params.to_json, headers)

puts response.body

✔️ Expected Behavior

The total execution time of the workflow is within 100 seconds. Therefore, the workflow result should be successfully received by the client making the API call.

The Workflow App API documentation includes a description of the response_mode.

response_mode (string) Required The mode of response return, supporting:

  • streaming Streaming mode (recommended), implements a typewriter-like output through SSE (Server-Sent Events).
  • blocking Blocking mode, returns result after execution is complete. (Requests may be interrupted if the process is long) Due to Cloudflare restrictions, the request will be interrupted without a return after 100 seconds.

According to this, in blocking mode, if the execution waiting time exceeds 100 seconds, the API execution wait will be interrupted due to Cloudflare restrictions.

Actual Behavior

A Cloudflare Gateway Timeout HTML page was returned as the response, indicating that the request timed out before the workflow could complete. (about 60 seconds after run workflow)

For reference, the response was HTML like the following

<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head>


<title>api.dify.ai | 504: Gateway time-out</title>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/main.css" />


Originally created by @snaka on GitHub (Mar 13, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [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] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.0.1 ### Cloud or Self Hosted Cloud ### Steps to reproduce 1. Create a workflow in Dify that sequentially executes six code blocks. 2. Each code block contains the following Python code, which simulates a long-running task by sleeping for 10 seconds: ```python import time def main() -> dict: time.sleep(20) return {} ``` Note: The reason for having six sleep codes of 10 seconds each is that the entire workflow is intended to have a wait time of 60 seconds or more. 3. Save and publish the workflow you have created. 4. Execute the created workflow using the following Ruby code: ```ruby require 'net/http' require 'uri' require 'json' uri = URI.parse("https://api.dify.ai/v1/workflows/run") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true http.read_timeout = 300 # 300 sec. = 5 min. headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY' # Replace with your actual API key } params = { inputs: {}, response_mode: 'blocking', user: "foo" } response = http.post(uri.path, params.to_json, headers) puts response.body ``` ### ✔️ Expected Behavior The total execution time of the workflow is within 100 seconds. Therefore, the workflow result should be successfully received by the client making the API call. The Workflow App API documentation includes a description of the `response_mode`. > `response_mode` (string) Required The mode of response return, supporting: > - `streaming` Streaming mode (recommended), implements a typewriter-like output through SSE ([Server-Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)). > - `blocking` Blocking mode, returns result after execution is complete. (Requests may be interrupted if the process is long) Due to Cloudflare restrictions, the request will be interrupted without a return after 100 seconds. According to this, in `blocking` mode, if the execution waiting time exceeds 100 seconds, the API execution wait will be interrupted due to Cloudflare restrictions. ### ❌ Actual Behavior A Cloudflare Gateway Timeout HTML page was returned as the response, indicating that the request timed out before the workflow could complete. (about 60 seconds after run workflow) For reference, the response was HTML like the following ```html <!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]--> <!--[if IE 7]> <html class="no-js ie7 oldie" lang="en-US"> <![endif]--> <!--[if IE 8]> <html class="no-js ie8 oldie" lang="en-US"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]--> <head> <title>api.dify.ai | 504: Gateway time-out</title> <meta charset="UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> <meta name="robots" content="noindex, nofollow" /> <meta name="viewport" content="width=device-width,initial-scale=1" /> <link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/main.css" /> ```
yindo added the 🐞 bugcloud labels 2026-02-21 18:51:32 -05:00
yindo closed this issue 2026-02-21 18:51:32 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#10822