File size: 1,050 Bytes
4c9238e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const { QdrantClient } = require("@qdrant/js-client-rest");
require('dotenv').config({ path: './.env' });

async function check(url, key) {
    console.log(`\nTesting URL: ${url}`);
    const client = new QdrantClient({
        url: url,
        apiKey: key,
        checkCompatibility: false
    });
    try {
        const result = await client.getCollections();
        console.log("SUCCESS: Connected!");
        return true;
    } catch (e) {
        console.log(`FAILED (${e.status || '?'}) : ${e.message}`);
        return false;
    }
}

async function debug() {
    const originalUrl = process.env.QDRANT_URL;
    const key = process.env.QDRANT_API_KEY;

    // Test 1: As provided
    await check(originalUrl, key);

    // Test 2: Without Port
    if (originalUrl.includes(':6333')) {
        const noPortUrl = originalUrl.replace(':6333', '');
        const success = await check(noPortUrl, key);
        if (success) {
            console.log("\nRECOMMENDATION: Remove ':6333' from your QDRANT_URL in .env");
        }
    }
}

debug();