Dify connect to external knowledge base #20785

Closed
opened 2026-02-21 20:08:58 -05:00 by yindo · 1 comment
Owner

Originally created by @Stephenouu on GitHub (Dec 4, 2025).

Originally assigned to: @hjlarry on GitHub.

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.10.1

Cloud or Self Hosted

Cloud

Steps to reproduce

I was trying to connect to an external knowledge base, but it failed while I was adding the api endpoint and api key. I tested both LlamaCloud and AWS Bedrock, but neither platform worked (see below for screenshots). For the AWS Bedrock, I created and tested my own API endpoint, but it failed when adding it to the Dify. I think this might be an internal issue in Dify? Because I followed the guideline from the official tutorial.

Image Image

✔️ Expected Behavior

It should let you connect to the API endpoint, and then it will be able to connect to the external knowledge base.

Actual Behavior

It failed to connect to the endpoint, shown in the above screenshots.

Originally created by @Stephenouu on GitHub (Dec 4, 2025). Originally assigned to: @hjlarry on GitHub. ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [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, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.10.1 ### Cloud or Self Hosted Cloud ### Steps to reproduce I was trying to connect to an external knowledge base, but it failed while I was adding the api endpoint and api key. I tested both LlamaCloud and AWS Bedrock, but neither platform worked (see below for screenshots). For the AWS Bedrock, I created and tested my own API endpoint, but it failed when adding it to the Dify. I think this might be an internal issue in Dify? Because I followed the guideline from the [official tutorial](https://docs.dify.ai/en/use-dify/knowledge/connect-external-knowledge-base). <img width="1280" height="771" alt="Image" src="https://github.com/user-attachments/assets/9a826745-643d-444e-a3da-368cc0f39dd9" /> <img width="1280" height="645" alt="Image" src="https://github.com/user-attachments/assets/4506b575-9904-4784-a9fd-3422c6e9d262" /> ### ✔️ Expected Behavior It should let you connect to the API endpoint, and then it will be able to connect to the external knowledge base. ### ❌ Actual Behavior It failed to connect to the endpoint, shown in the above screenshots.
yindo closed this issue 2026-02-21 20:08:58 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 4, 2025):

Hi @Stephenouu! I'm Dosu and I’m helping the dify team.

Dify supports connecting to external knowledge bases like LlamaCloud and AWS Bedrock via API endpoints, but there are a few common pitfalls that can cause connection failures:

  • The endpoint URL you provide should not include /retrieval at the end—Dify appends this automatically when making requests. For example, if your endpoint is https://api.example.com/retrieval, enter only https://api.example.com in the Dify UI. This is a frequent cause of the "failed to connect to the endpoint" error, especially with LlamaCloud integrations (source).
  • The endpoint must start with http:// or https:// and be publicly accessible. Localhost URLs (like http://localhost:8000) will not work in cloud deployments. If your API is running locally, expose it using a tool like Ngrok or use host.docker.internal for Docker setups (source).
  • For LlamaCloud, the API key field can be any value (since authorization is not enforced), but for other providers, ensure the key is correct and valid.
  • Dify expects the external API to accept a POST request to <endpoint>/retrieval with a JSON body containing knowledge_id, query, and retrieval_setting, and to return a JSON object with a records array (each record should have content, score, title, and optionally metadata) (source).
  • Typos, missing required fields, or network/firewall issues can also cause connection failures. Double-check the endpoint, API key, and network accessibility.
  • If you update the API key in the UI, Dify may continue using the old key until you delete and recreate the connection (source).
  • If your external knowledge base uses a different request/response format (e.g., Ragflow), you may need an adapter (like nginx+lua) to translate between Dify's expected schema and your API (source).

Recent updates to Dify have improved validation and error handling for these integrations, so following these setup steps should resolve most issues. If you still encounter problems, check the error message details and verify that your endpoint and API key meet the requirements above.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Dec 4, 2025): <!-- Greeting --> Hi @Stephenouu! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> Dify supports connecting to external knowledge bases like LlamaCloud and AWS Bedrock via API endpoints, but there are a few common pitfalls that can cause connection failures: - The endpoint URL you provide should **not** include `/retrieval` at the end—Dify appends this automatically when making requests. For example, if your endpoint is `https://api.example.com/retrieval`, enter only `https://api.example.com` in the Dify UI. This is a frequent cause of the "failed to connect to the endpoint" error, especially with LlamaCloud integrations [(source)](https://github.com/langgenius/dify/issues/29014). - The endpoint must start with `http://` or `https://` and be publicly accessible. Localhost URLs (like `http://localhost:8000`) will not work in cloud deployments. If your API is running locally, expose it using a tool like Ngrok or use `host.docker.internal` for Docker setups [(source)](https://github.com/langgenius/dify/issues/17905). - For LlamaCloud, the API key field can be any value (since authorization is not enforced), but for other providers, ensure the key is correct and valid. - Dify expects the external API to accept a POST request to `<endpoint>/retrieval` with a JSON body containing `knowledge_id`, `query`, and `retrieval_setting`, and to return a JSON object with a `records` array (each record should have `content`, `score`, `title`, and optionally `metadata`) [(source)](https://github.com/langgenius/dify/issues/14383). - Typos, missing required fields, or network/firewall issues can also cause connection failures. Double-check the endpoint, API key, and network accessibility. - If you update the API key in the UI, Dify may continue using the old key until you delete and recreate the connection [(source)](https://github.com/langgenius/dify/issues/28458). - If your external knowledge base uses a different request/response format (e.g., Ragflow), you may need an adapter (like nginx+lua) to translate between Dify's expected schema and your API [(source)](https://github.com/langgenius/dify/issues/15926). Recent updates to Dify have improved validation and error handling for these integrations, so following these setup steps should resolve most issues. If you still encounter problems, check the error message details and verify that your endpoint and API key meet the requirements above. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/d9d348e5-5323-4b0d-a550-e36178a78a2e?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/d9d348e5-5323-4b0d-a550-e36178a78a2e?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/d9d348e5-5323-4b0d-a550-e36178a78a2e?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/d9d348e5-5323-4b0d-a550-e36178a78a2e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/d9d348e5-5323-4b0d-a550-e36178a78a2e?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/d9d348e5-5323-4b0d-a550-e36178a78a2e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/d9d348e5-5323-4b0d-a550-e36178a78a2e?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Dify%20supports%20connecting%20to%20external%20knowledge%20bases%20like%20LlamaCloud%20and%20AWS%20Bedrock%20via%20API%20endpoints%2C%20but%20there%20are%20a%20few%20common%20pitfalls%20that%20can%20cause%20connection%20failures%3A%0A%0A-%20The%20endpoint%20URL%20you%20provide%20should%20%2A%2Anot%2A%2A%20include%20%60/retrieval%60%20at%20the%20end%E2%80%94Dify%20appends%20this%20automatically%20when%20making%20requests.%20For%20example%2C%20if%20your%20endpoint%20is%20%60https%3A//api.example.com/retrieval%60%2C%20enter%20only%20%60https%3A//api.example.com%60%20in%20the%20Dify%20UI.%20This%20is%20a%20frequent%20cause%20of%20the%20%22failed%20to%20connect%20to%20the%20endpoint%22%20error%2C%20especially%20with%20LlamaCloud%20integrations%20%5B%28source%29%5D%28https%3A//github.com/langgenius/dify/issues/29014%29.%0A-%20The%20endpoint%20must%20start%20with%20%60http%3A//%60%20or%20%60https%3A//%60%20and%20be%20publicly%20accessible.%20Localhost%20URLs%20%28like%20%60http%3A//localhost%3A8000%60%29%20will%20not%20work%20in%20cloud%20deployments.%20If%20your%20API%20is%20running%20locally%2C%20expose%20it%20using%20a%20tool%20like%20Ngrok%20or%20use%20%60host.docker.internal%60%20for%20Docker%20setups%20%5B%28source%29%5D%28https%3A//github.com/langgenius/dify/issues/17905%29.%0A-%20For%20LlamaCloud%2C%20the%20API%20key%20field%20can%20be%20any%20value%20%28since%20authorization%20is%20not%20enforced%29%2C%20but%20for%20other%20providers%2C%20ensure%20the%20key%20is%20correct%20and%20valid.%0A-%20Dify%20expects%20the%20external%20API%20to%20accept%20a%20POST%20request%20to%20%60%3Cendpoint%3E/retrieval%60%20with%20a%20JSON%20body%20containing%20%60knowledge_id%60%2C%20%60query%60%2C%20and%20%60retrieval_setting%60%2C%20and%20to%20return%20a%20JSON%20object%20with%20a%20%60records%60%20array%20%28each%20record%20should%20have%20%60content%60%2C%20%60score%60%2C%20%60title%60%2C%20and%20optionally%20%60metadata%60%29%20%5B%28source%29%5D%28https%3A//github.com/langgenius/dify/issues/14383%29.%0A-%20Typos%2C%20missing%20required%20fields%2C%20or%20network/firewall%20issues%20can%20also%20cause%20connection%20failures.%20Double-check%20the%20endpoint%2C%20API%20key%2C%20and%20network%20accessibility.%0A-%20If%20you%20update%20the%20API%20key%20in%20the%20UI%2C%20Dify%20may%20continue%20using%20the%20old%20key%20until%20you%20delete%20and%20recreate%20the%20connection%20%5B%28source%29%5D%28https%3A//github.com/langgenius/dify/issues/28458%29.%0A-%20If%20your%20external%20knowledge%20base%20uses%20a%20different%20request/response%20format%20%28e.g.%2C%20Ragflow%29%2C%20you%20may%20need%20an%20adapter%20%28like%20nginx%2Blua%29%20to%20translate%20between%20Dify%27s%20expected%20schema%20and%20your%20API%20%5B%28source%29%5D%28https%3A//github.com/langgenius/dify/issues/15926%29.%0A%0ARecent%20updates%20to%20Dify%20have%20improved%20validation%20and%20error%20handling%20for%20these%20integrations%2C%20so%20following%20these%20setup%20steps%20should%20resolve%20most%20issues.%20If%20you%20still%20encounter%20problems%2C%20check%20the%20error%20message%20details%20and%20verify%20that%20your%20endpoint%20and%20API%20key%20meet%20the%20requirements%20above.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/29119)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20785