dify icon indicating copy to clipboard operation
dify copied to clipboard

Access to workflow via api appears 401

Open dgzxx-2000 opened this issue 8 months ago • 1 comments

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

1.1.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

import requests

def upload_raw_binary(binary_data, file_name,file_type):

    upload_url = "https://api.dify.ai/v1/files/upload"
    
    headers = {
        'Authorization': f'Bearer app-xxxxx'
    }

    proxies = {
        'http': 'http://127.0.0.1:33210',  # HTTP 代理
        'https': 'http://127.0.0.1:33210'  # HTTPS 代理
    }
    
   
    response = requests.post(
        upload_url,
        proxies=proxies,
        headers=headers,
        files={'file': (file_name, binary_data, 'application/octet-stream')},
        data={"user": "abc-123", "type": file_type}
    )
    print(response)
    
    return response.json().get("id")

audio_id = upload_raw_binary(audio_binary_data, r"D:\hf_pro\Image_recognition\Ultraman\audio\1.m4a", file_type="audio")
image_id = upload_raw_binary(image_binary_data, r"D:\hf_pro\Image_recognition\Ultraman\images\1.png", file_type="image")
ConnectionResetError                      Traceback (most recent call last)
File d:\anconda\Lib\site-packages\urllib3\connectionpool.py:775, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)
    [774](file:///D:/anconda/Lib/site-packages/urllib3/connectionpool.py:774) try:
--> [775](file:///D:/anconda/Lib/site-packages/urllib3/connectionpool.py:775)     self._prepare_proxy(conn)
    [776](file:///D:/anconda/Lib/site-packages/urllib3/connectionpool.py:776) except (BaseSSLError, OSError, SocketTimeout) as e:

File d:\anconda\Lib\site-packages\urllib3\connectionpool.py:1044, in HTTPSConnectionPool._prepare_proxy(self, conn)
   [1038](file:///D:/anconda/Lib/site-packages/urllib3/connectionpool.py:1038) conn.set_tunnel(
   [1039](file:///D:/anconda/Lib/site-packages/urllib3/connectionpool.py:1039)     scheme=tunnel_scheme,
   [1040](file:///D:/anconda/Lib/site-packages/urllib3/connectionpool.py:1040)     host=self._tunnel_host,
   [1041](file:///D:/anconda/Lib/site-packages/urllib3/connectionpool.py:1041)     port=self.port,
   [1042](file:///D:/anconda/Lib/site-packages/urllib3/connectionpool.py:1042)     headers=self.proxy_headers,
   [1043](file:///D:/anconda/Lib/site-packages/urllib3/connectionpool.py:1043) )
-> [1044](file:///D:/anconda/Lib/site-packages/urllib3/connectionpool.py:1044) conn.connect()

File d:\anconda\Lib\site-packages\urllib3\connection.py:730, in HTTPSConnection.connect(self)
    [728](file:///D:/anconda/Lib/site-packages/urllib3/connection.py:728) server_hostname_rm_dot = server_hostname.rstrip(".")
--> [730](file:///D:/anconda/Lib/site-packages/urllib3/connection.py:730) sock_and_verified = _ssl_wrap_socket_and_match_hostname(
    [731](file:///D:/anconda/Lib/site-packages/urllib3/connection.py:731)     sock=sock,
    [732](file:///D:/anconda/Lib/site-packages/urllib3/connection.py:732)     cert_reqs=self.cert_reqs,
    [733](file:///D:/anconda/Lib/site-packages/urllib3/connection.py:733)     ssl_version=self.ssl_version,
    [734](file:///D:/anconda/Lib/site-packages/urllib3/connection.py:734)     ssl_minimum_version=self.ssl_minimum_version,
    [735](file:///D:/anconda/Lib/site-packages/urllib3/connection.py:735)     ssl_maximum_version=self.ssl_maximum_version,
    [736](file:///D:/anconda/Lib/site-packages/urllib3/connection.py:736)     ca_certs=self.ca_certs,
...
    [684](file:///D:/anconda/Lib/site-packages/requests/adapters.py:684) except MaxRetryError as e:
    [685](file:///D:/anconda/Lib/site-packages/requests/adapters.py:685)     if isinstance(e.reason, ConnectTimeoutError):
    [686](file:///D:/anconda/Lib/site-packages/requests/adapters.py:686)         # TODO: Remove this in 3.0.0: see #2811

ConnectionError: ('Connection aborted.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None))
Output is truncated. View as a [scrollable element](command:cellOutput.enableScrolling?6812b0f7-c3e9-40a2-b7da-ef448566bdeb) or open in a [text editor](command:workbench.action.openLargeOutput?6812b0f7-c3e9-40a2-b7da-ef448566bdeb). Adjust cell output [settings](command:workbench.action.openSettings?%5B%22%40tag%3AnotebookOutputLayout%22%5D)...

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

dgzxx-2000 avatar Mar 30 '25 10:03 dgzxx-2000