Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qdrant collections can't be listed in a hosted environement #12381

Open
nicolas-geysse opened this issue Dec 27, 2024 · 9 comments
Open

Qdrant collections can't be listed in a hosted environement #12381

nicolas-geysse opened this issue Dec 27, 2024 · 9 comments
Labels
in linear Issue or PR has been created in Linear for internal review

Comments

@nicolas-geysse
Copy link

Bug Description

Hello,
I may create, list, and anything I want using http request node to connect a Cloud version but also a hosted version of Qdrant.
In the n8n Qdrant node, I may list the collections directly without any problems, but it fails for the hosted version.
Capture d'écran 2024-12-27 005856
Capture d'écran 2024-12-27 005928
hosted

To Reproduce

1.Host an instance of Qdrant in your infrastructure.
2.Create your credentials, the connection with the credentials is working fine
3.Use the Qdrant node to list collections.
4. :(
5. Do that with the Cloud version of Qdrant
6. :)

Expected behavior

As my connection between n8n and my hosted version of Qdrant, it should handle the same way the Cloud version.

Operating System

?

n8n Version

1.72.1

Node.js Version

20.18.0

Database

PostgreSQL

Execution mode

queue

@Joffcom
Copy link
Member

Joffcom commented Dec 27, 2024

Hey @nicolas-geysse,

We have created an internal ticket to look into this which we will be tracking as "N8N-8014"

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label Dec 27, 2024
@Joffcom
Copy link
Member

Joffcom commented Dec 27, 2024

Hey @nicolas-geysse

Just to check are you using localhost as the host address for your local qdrant instance?

@nicolas-geysse
Copy link
Author

nicolas-geysse commented Dec 27, 2024

Hello @Joffcom
No, it's hosted on Railway (Qdrant as n8n), proxied with Cloudflare. (but fails also without it)

@HT-Moh
Copy link

HT-Moh commented Jan 5, 2025

I have the same issue with Qdrant, my instance works, but when using n8n node for Qdrant credentials are green but I can not list the collections.

curl 'https://myqdrant_host_name/collections' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'accept-language: en-US,en;q=0.7' \
  -H 'api-key: mytoken=' \
  -H 'content-type: application/json' \
  -H 'priority: u=1, i' \
  -H 'x-inference-proxy: true'
{"result":{"collections":[{"name":"contacts"}]},"status":"ok","time":0.00001614}

@jeanpaul
Copy link
Contributor

jeanpaul commented Jan 7, 2025

@nicolas-geysse For me it's working correctly when I run everything locally, even when adding an API key. Is there anything special about your setup?

@jeanpaul
Copy link
Contributor

jeanpaul commented Jan 7, 2025

@nicolas-geysse Ah, maybe it's something else... I tried a bit more and came to the conclusion that there might be an issue with saving the credential if you change the URL after you've entered the API key. Can you try re-entering your API key in the credential and saving it? You may need to use the three-dot menu near "Qdrant Collection" to refresh the list:
image

@nicolas-geysse
Copy link
Author

nicolas-geysse commented Jan 7, 2025

@jeanpaul Hello, I don't see anything special in my setup...I wonder if that might be related to IP v4 and v6 (not supported with n8n, but with Qdrant)
I've seen this topic that seems related
qdrant/qdrant#5545
I have this in my logs :

fetch failed

TypeError: fetch failed
    at node:internal/deps/undici/undici:13185:13
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at fetchJson (/usr/local/lib/node_modules/n8n/node_modules/@qdrant/openapi-typescript-fetch/dist/cjs/fetcher.js:135:22)
    at /usr/local/lib/node_modules/n8n/node_modules/@qdrant/js-client-rest/dist/cjs/api-client.js:46:26
    at handler (/usr/local/lib/node_modules/n8n/node_modules/@qdrant/openapi-typescript-fetch/dist/cjs/fetcher.js:156:16)
    at /usr/local/lib/node_modules/n8n/node_modules/@qdrant/js-client-rest/dist/cjs/api-client.js:32:24
    at handler (/usr/local/lib/node_modules/n8n/node_modules/@qdrant/openapi-typescript-fetch/dist/cjs/fetcher.js:156:16)
    at fetchUrl (/usr/local/lib/node_modules/n8n/node_modules/@qdrant/openapi-typescript-fetch/dist/cjs/fetcher.js:162:22)
    at Object.fun [as getCollections] (/usr/local/lib/node_modules/n8n/node_modules/@qdrant/openapi-typescript-fetch/dist/cjs/fetcher.js:168:20)
    at QdrantClient.getCollections (/usr/local/lib/node_modules/n8n/node_modules/@qdrant/js-client-rest/dist/cjs/qdrant-client.js:836:26)
    at LoadOptionsContext.qdrantCollectionsSearch (/usr/local/lib/node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/shared/methods/listSearch.js:51:22)
    at DynamicNodeParametersController.getResourceLocatorResults (/usr/local/lib/node_modules/n8n/dist/controllers/dynamic-node-parameters.controller.js:37:16)
    at handler (/usr/local/lib/node_modules/n8n/dist/decorators/controller.registry.js:93:24)
    at /usr/local/lib/node_modules/n8n/dist/response-helper.js:110:26
 
Connect Timeout Error
ConnectTimeoutError: Connect Timeout Error
    at onConnectTimeout (/usr/local/lib/node_modules/n8n/node_modules/@qdrant/js-client-rest/node_modules/undici/lib/core/connect.js:186:24)
    at /usr/local/lib/node_modules/n8n/node_modules/@qdrant/js-client-rest/node_modules/undici/lib/core/connect.js:133:46
    at Immediate._onImmediate (/usr/local/lib/node_modules/n8n/node_modules/@qdrant/js-client-rest/node_modules/undici/lib/core/connect.js:174:9)
    at processImmediate (node:internal/timers:483:21)

@jeanpaul
Copy link
Contributor

jeanpaul commented Jan 7, 2025

@nicolas-geysse did you see my comment on re-adding your credential? If that's the issue, there should be a fix released soon. If that doesn't, we should look into it some more.

@nicolas-geysse
Copy link
Author

nicolas-geysse commented Jan 7, 2025

@jeanpaul yes, I did that, same result. But it's getting weirder as if I set an empty API key in the credentials, the connection is allowed ! If I enter anything, it also works !
So I double checked the API key, it does exists, and I've tested this node into n8n :

async function execute() {
    const baseUrl = "https://myhostedqdrant";
    const apiKey = "myAPIkey";

    const options = {
        uri: `${baseUrl}/collections`,
        method: 'GET',
        headers: {
            'Content-Type': 'application/json',
            'Accept': 'application/json',
            'api-key': apiKey
        },
        json: true,
        timeout: 15000
    };

    try {
        const data = await this.helpers.request(options);
        
        return [{
            json: {
                status: "success",
                collections: data,
                endpoint: baseUrl
            }
        }];

    } catch (error) {
        return [{
            json: {
                status: "error",
                message: error.message,
                endpoint: baseUrl,
                errorDetails: error.response ? error.response.data : null
            }
        }];
    }
}

return execute();

With an empty API key, or anything, it doesn't work (as expected). With the correct API key, no problem, I do have the list of my collections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

No branches or pull requests

4 participants