qdrant-js
qdrant-js copied to clipboard
When client is configured using url, port seems to be incorrectly set on some methods
I have a weird error: when Qdrant client is initialized with a full URL (ie https://hostname:port), client methods fails with a fetch failed / timeout errors but some don't.
The code:
const qdrantClient = new QdrantClient({ url: 'https://mydomain.com:443' });
try {
await qdrantClient.getCollection('test');
} catch (e) {
console.log(e);
}
When used locally with a URL like http://localhost:6333 there's no issue, but when the URL is https://mydomain.com:443 I get a fetch failed error.
If I add the port manually in the client setup:
const qdrantClient = new QdrantClient({ url: 'https://mydomain.com:443', port: 443 });
It works normally.
EDIT: ~~It also seems only some methods are affected by this, as I can make search queries just fine without having the port explicitly set?~~
Hello, This issue arises because of the way URL package parses urls with default ports (443 for https and 80 for http) -
Note: If an input string passed to the URL() constructor doesn't contain an explicit port number (e.g., https://localhost) or contains a port number that's the default port number corresponding to the protocol part of the input string (e.g., https://localhost:443), then in the URL object the constructor returns, the value of the port property will be the empty string: ''.
reference: port
Would like to chip in here. As we hosted qdrant in a self-host vanilla k8s and exposed the service via https instead of node port. We suspect this is the reason why we cannot integrate this qdrant service with others such as anything-llm in this way.