Bug: Chat document selector shows "No documents available" in non-localhost deployments
AND because I feel like it, another issue I encountered. As usual: CHECK PRIOR IMPLEMENTING.
Summary
The document/folder selector in the Chat view always shows "No documents available" when Morphik is accessed via a non-localhost URL (e.g. http://x.x.x.x.x:xxxx). Documents are never fetched because the fetch guard condition fails silently.
Environment
- Deployment: Docker (self-hosted), accessed via LAN IP
- Image:
ghcr.io/morphik-org/morphik-core:latest
- UI:
node:22-alpine with ee/ui-component volume mount
- Auth:
bypass_auth_mode = true
- Date observed: 2026-02-13
Symptoms
- Chat page loads normally, queries work if no document filter is needed
- "Select documents and folders" dropdown shows "No documents available"
- No
Fetching documents from: log appears in browser console
- The
/documents/list_docs endpoint is never called from the Chat view
- Documents page works correctly (lists all documents)
- Search with ColPali finds documents normally
Root Cause
File: ee/ui-component/components/chat/ChatSection.tsx, ~line 317
The useEffect that triggers fetchDocuments() and fetchFolders() has a guard condition:
if (authToken || apiBaseUrl.includes("localhost")) {
await fetchFolders();
await fetchDocuments();
}
When bypass_auth_mode = true:
authToken is null
apiBaseUrl is http://x.x.x.x.x:xxxx (does not contain "localhost")
Both conditions are false → data fetching is silently skipped.
This means any non-localhost deployment with bypass_auth_mode will have a broken document selector in the Chat view.
Fix
The guard should also allow fetching when apiBaseUrl is set (which means a valid connection exists):
// Before
if (authToken || apiBaseUrl.includes("localhost")) {
// After
if (authToken || apiBaseUrl) {
The apiBaseUrl check is sufficient — the function already has its own if (!apiBaseUrl) return; guard at the top, so a falsy apiBaseUrl is already handled.
Related
This is the second frontend bug caused by assumptions about localhost deployments. See also: PDF Viewer broken due to POST /documents response format mismatch (paginated object vs. array).
Verification
After patching, the Chat document selector correctly loads and displays all documents and folders.
Bug: Chat document selector shows "No documents available" in non-localhost deployments
AND because I feel like it, another issue I encountered. As usual: CHECK PRIOR IMPLEMENTING.
Summary
The document/folder selector in the Chat view always shows "No documents available" when Morphik is accessed via a non-localhost URL (e.g.
http://x.x.x.x.x:xxxx). Documents are never fetched because the fetch guard condition fails silently.Environment
ghcr.io/morphik-org/morphik-core:latestnode:22-alpinewithee/ui-componentvolume mountbypass_auth_mode = trueSymptoms
Fetching documents from:log appears in browser console/documents/list_docsendpoint is never called from the Chat viewRoot Cause
File:
ee/ui-component/components/chat/ChatSection.tsx, ~line 317The
useEffectthat triggersfetchDocuments()andfetchFolders()has a guard condition:When
bypass_auth_mode = true:authTokenisnullapiBaseUrlishttp://x.x.x.x.x:xxxx(does not contain "localhost")Both conditions are
false→ data fetching is silently skipped.This means any non-localhost deployment with
bypass_auth_modewill have a broken document selector in the Chat view.Fix
The guard should also allow fetching when
apiBaseUrlis set (which means a valid connection exists):The
apiBaseUrlcheck is sufficient — the function already has its ownif (!apiBaseUrl) return;guard at the top, so a falsyapiBaseUrlis already handled.Related
This is the second frontend bug caused by assumptions about localhost deployments. See also: PDF Viewer broken due to
POST /documentsresponse format mismatch (paginated object vs. array).Verification
After patching, the Chat document selector correctly loads and displays all documents and folders.