Cannot get the url property in local upload. #11829

Closed
opened 2026-02-21 19:04:16 -05:00 by yindo · 4 comments
Owner

Originally created by @Velvet0314 on GitHub (Mar 19, 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.1.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When locally upload the image at start node, the following node cannot get the url property from variable.

✔️ Expected Behavior

No response

Actual Behavior

start node output as follow:

{
  "sketch": {
    "dify_model_identity": "__dify__file__",
    "id": null,
    "tenant_id": "c7086304-4e22-44b1-90dd-a541aad38b10",
    "type": "image",
    "transfer_method": "local_file",
    "remote_url": "",
    "related_id": "ad1a975b-a3d2-4027-9098-e4a9b9d920fd",
    "filename": "sketch.png",
    "extension": ".png",
    "mime_type": "image/png",
    "size": 6695,
    "url": "/files/ad1a975b-a3d2-4027-9098-e4a9b9d920fd/file-preview?timestamp=1742431090&nonce=959184f1a477cc9570da978c441e1065&sign=iOUcBCh23MV8Nb4PB2vi52Ro3skIeuyc6dRRTQAAP2s="
  },
  "sys.query": "1",
  "sys.files": [],
  "sys.conversation_id": "3c809b6f-c30a-44f5-a22d-18fa5c8f9330",
  "sys.user_id": "8c37c467-7fc0-4e41-8219-a60a91f80d34",
  "sys.dialogue_count": 0,
  "sys.app_id": "cc6c4a85-66ee-4e97-94be-2637a6369bea",
  "sys.workflow_id": "91a01099-477b-4b38-9750-edd57f78a472",
  "sys.workflow_run_id": "3ea191c0-6147-43a4-aeee-5c63b33cb341"
}

But in the following node:

def main(url: str) -> dict:
    return {
        "result": url
    }

output is null:

Image

It seems that following node cannot get the url property?

Originally created by @Velvet0314 on GitHub (Mar 19, 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.1.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When locally upload the image at start node, the following node cannot get the url property from variable. ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior start node output as follow: ```json { "sketch": { "dify_model_identity": "__dify__file__", "id": null, "tenant_id": "c7086304-4e22-44b1-90dd-a541aad38b10", "type": "image", "transfer_method": "local_file", "remote_url": "", "related_id": "ad1a975b-a3d2-4027-9098-e4a9b9d920fd", "filename": "sketch.png", "extension": ".png", "mime_type": "image/png", "size": 6695, "url": "/files/ad1a975b-a3d2-4027-9098-e4a9b9d920fd/file-preview?timestamp=1742431090&nonce=959184f1a477cc9570da978c441e1065&sign=iOUcBCh23MV8Nb4PB2vi52Ro3skIeuyc6dRRTQAAP2s=" }, "sys.query": "1", "sys.files": [], "sys.conversation_id": "3c809b6f-c30a-44f5-a22d-18fa5c8f9330", "sys.user_id": "8c37c467-7fc0-4e41-8219-a60a91f80d34", "sys.dialogue_count": 0, "sys.app_id": "cc6c4a85-66ee-4e97-94be-2637a6369bea", "sys.workflow_id": "91a01099-477b-4b38-9750-edd57f78a472", "sys.workflow_run_id": "3ea191c0-6147-43a4-aeee-5c63b33cb341" } ``` But in the following node: ```python def main(url: str) -> dict: return { "result": url } ``` output is null: ![Image](https://github.com/user-attachments/assets/df3476d1-723e-487e-8a1d-8267fa88b288) It seems that following node cannot get the url property?
yindo added the 🐞 bug label 2026-02-21 19:04:16 -05:00
yindo closed this issue 2026-02-21 19:04:16 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 19, 2025):

I found a similar closed issue where users were unable to retrieve the URL variable from a file in a self-hosted Dify setup using Docker. The solution involves ensuring that the environment variables are correctly loaded from the .env file or directly set in the docker-compose.yaml file. Here's a snippet that demonstrates how to load these variables using DifyConfig and verify their values:

def test_flask_configs(example_env_file):
    flask_app = Flask("app")
    os.environ.clear()
    flask_app.config.from_mapping(DifyConfig(_env_file=example_env_file).model_dump())  # pyright: ignore
    config = flask_app.config

    assert config["CONSOLE_API_URL"] == "https://example.com"
    assert config["FILES_URL"] == "https://example.com"
    assert config["CONSOLE_WEB_URL"] == "https://example.com"

Ensure that your .env file is correctly formatted and located in the expected directory. Alternatively, set the environment variables directly in the docker-compose.yaml file under the environment section for the relevant service:

services:
  api:
    environment:
      CONSOLE_API_URL: 'https://example.com'
      CONSOLE_WEB_URL: 'https://example.com'
      FILES_URL: 'https://example.com'

If the URL is returning an empty string, verify that the .env file or the docker-compose.yaml file is correctly set up and that the DifyConfig is properly loading it [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Mar 19, 2025): <!-- Answer --> I found a similar closed issue where users were unable to retrieve the URL variable from a file in a self-hosted Dify setup using Docker. The solution involves ensuring that the environment variables are correctly loaded from the `.env` file or directly set in the `docker-compose.yaml` file. Here's a snippet that demonstrates how to load these variables using `DifyConfig` and verify their values: ```python def test_flask_configs(example_env_file): flask_app = Flask("app") os.environ.clear() flask_app.config.from_mapping(DifyConfig(_env_file=example_env_file).model_dump()) # pyright: ignore config = flask_app.config assert config["CONSOLE_API_URL"] == "https://example.com" assert config["FILES_URL"] == "https://example.com" assert config["CONSOLE_WEB_URL"] == "https://example.com" ``` Ensure that your `.env` file is correctly formatted and located in the expected directory. Alternatively, set the environment variables directly in the `docker-compose.yaml` file under the `environment` section for the relevant service: ```yaml services: api: environment: CONSOLE_API_URL: 'https://example.com' CONSOLE_WEB_URL: 'https://example.com' FILES_URL: 'https://example.com' ``` If the URL is returning an empty string, verify that the `.env` file or the `docker-compose.yaml` file is correctly set up and that the `DifyConfig` is properly loading it <sup>[[1]](https://github.com/langgenius/dify/issues/10380)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/7a92b9f3-1c2b-4f71-af38-685ce665eb23?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/7a92b9f3-1c2b-4f71-af38-685ce665eb23?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/7a92b9f3-1c2b-4f71-af38-685ce665eb23?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/7a92b9f3-1c2b-4f71-af38-685ce665eb23?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/7a92b9f3-1c2b-4f71-af38-685ce665eb23?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/7a92b9f3-1c2b-4f71-af38-685ce665eb23?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/7a92b9f3-1c2b-4f71-af38-685ce665eb23?feedback_type=other)</sup>
Author
Owner

@Velvet0314 commented on GitHub (Mar 19, 2025):

@dosu

Image

I used the file upload following official document, the url property in deed showed. But I cannot use the variable in the following node. It's because when following node tried to get the url property, it's none.

@Velvet0314 commented on GitHub (Mar 19, 2025): @dosu ![Image](https://github.com/user-attachments/assets/4acdcf61-975b-44d5-bed1-0f5ab97052d0) I used the file upload following official document, the url property in deed showed. But I cannot use the variable in the following node. It's because when following node tried to get the url property, it's none.
Author
Owner

@dosubot[bot] commented on GitHub (Mar 19, 2025):

To resolve the issue of the URL property showing as none in the following node of your workflow, you should use file.remote_url instead of file.url. This change will ensure that the workflow can properly access and use the file URLs, especially when the files are stored in an Object Storage Service (OSS) [1][2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Mar 19, 2025): <!-- Answer --> To resolve the issue of the URL property showing as none in the following node of your workflow, you should use `file.remote_url` instead of `file.url`. This change will ensure that the workflow can properly access and use the file URLs, especially when the files are stored in an Object Storage Service (OSS) <sup>[[1]](https://github.com/langgenius/dify/issues/15587)</sup><sup>[[2]](https://github.com/langgenius/dify/issues/14679)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/07cc98ee-dc8a-461e-aab9-0715e0a8aeeb?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/07cc98ee-dc8a-461e-aab9-0715e0a8aeeb?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/07cc98ee-dc8a-461e-aab9-0715e0a8aeeb?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/07cc98ee-dc8a-461e-aab9-0715e0a8aeeb?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/07cc98ee-dc8a-461e-aab9-0715e0a8aeeb?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/07cc98ee-dc8a-461e-aab9-0715e0a8aeeb?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/07cc98ee-dc8a-461e-aab9-0715e0a8aeeb?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Mar 19, 2025):

Yes this is an expected behavior, you can only get the url of the upload from the remote.

@crazywoola commented on GitHub (Mar 19, 2025): Yes this is an expected behavior, you can only get the url of the upload from the remote.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#11829