[File] The URL returned by _backwards_invoke does not contain the tenant_id #1

Closed
opened 2026-02-15 21:15:14 -05:00 by yindo · 1 comment
Owner

Originally created by @fujita-h on GitHub (Jan 11, 2025).

Summary

When I try to upload a file to the endpoint as follows, it fails:

class NewEndpoint(Endpoint):
    def _invoke(self, r: Request, values: Mapping, settings: Mapping) -> Response:
        response = self.session.file.upload(
            filename="test.txt",
            content=b"Hello, World!",
            mimetype="text/plain",
        )

Environment

Remote Plugin

Cause

https://github.com/langgenius/dify-plugin-sdks/blob/e764cd2d9e0225b9ac4f27d3e486ed0578b47a46/python/dify_plugin/invocations/file.py#L54-L62

The returnd url is
https://[snip]/files/upload/for-plugin?timestamp=[snip]&nonce=[snip]&sign=[snip]&user_id=[snip]

However, this API requires a tenant_id as shown below, and the API call fails.
https://github.com/langgenius/dify/blob/28edbbac0b4f3da7403de1f00b6cf0a8e4c0e24b/api/controllers/files/upload.py#L26-L28

Originally created by @fujita-h on GitHub (Jan 11, 2025). ## Summary When I try to upload a file to the endpoint as follows, it fails: ```python class NewEndpoint(Endpoint): def _invoke(self, r: Request, values: Mapping, settings: Mapping) -> Response: response = self.session.file.upload( filename="test.txt", content=b"Hello, World!", mimetype="text/plain", ) ``` ## Environment Remote Plugin ## Cause https://github.com/langgenius/dify-plugin-sdks/blob/e764cd2d9e0225b9ac4f27d3e486ed0578b47a46/python/dify_plugin/invocations/file.py#L54-L62 The returnd url is `https://[snip]/files/upload/for-plugin?timestamp=[snip]&nonce=[snip]&sign=[snip]&user_id=[snip]` However, this API requires a `tenant_id` as shown below, and the API call fails. https://github.com/langgenius/dify/blob/28edbbac0b4f3da7403de1f00b6cf0a8e4c0e24b/api/controllers/files/upload.py#L26-L28
yindo closed this issue 2026-02-15 21:15:14 -05:00
Author
Owner

@Yeuoly commented on GitHub (Jan 14, 2025):

fixed https://github.com/langgenius/dify/pull/12734

@Yeuoly commented on GitHub (Jan 14, 2025): fixed https://github.com/langgenius/dify/pull/12734
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugin-sdks#1