Skip to content

[Bug] Illegal host error when using QdrantClient with Qdrant Cloud in mem0 OSS (TypeScript) #3915

@SYRS-AI

Description

@SYRS-AI

Environment

  • mem0ai/oss version: latest (npm)
  • @qdrant/js-client-rest version: latest
  • Runtime: Next.js 16 on Railway (serverless)
  • Qdrant: Qdrant Cloud

Problem

When using mem0 OSS (TypeScript) with Qdrant Cloud, I consistently get an "Illegal host" error, even when passing a pre-configured QdrantClient or using the url parameter directly.

Steps to Reproduce

Attempt 1: Pre-configured QdrantClient with host+port+https

```typescript
const qdrantClient = new QdrantClient({
host: "xxx.us-west-1-0.aws.cloud.qdrant.io",
port: 6333,
apiKey: "xxx",
https: true,
})

const memory = new Memory({
vectorStore: {
provider: "qdrant",
config: {
client: qdrantClient,
collectionName: "my-collection",
},
},
// ... other config
})
```
Result: "Illegal host" error

Attempt 2: Pre-configured QdrantClient with url parameter

```typescript
const qdrantClient = new QdrantClient({
url: "https://xxx.us-west-1-0.aws.cloud.qdrant.io:6333",
apiKey: "xxx",
})

const memory = new Memory({
vectorStore: {
provider: "qdrant",
config: {
client: qdrantClient,
collectionName: "my-collection",
},
},
// ... other config
})
```
Result: "Illegal host" error

Attempt 3: Direct config without pre-configured client

```typescript
const memory = new Memory({
vectorStore: {
provider: "qdrant",
config: {
url: "https://xxx.us-west-1-0.aws.cloud.qdrant.io:6333",
apiKey: "xxx",
collectionName: "my-collection",
},
},
// ... other config
})
```
Result: "Illegal host" error

Important Finding

Direct QdrantClient connection works perfectly:
```typescript
const client = new QdrantClient({
url: "https://xxx.us-west-1-0.aws.cloud.qdrant.io:6333",
apiKey: "xxx"
})
const collection = await client.getCollection("my-collection")
// ✅ Works fine!
```

This confirms:

  1. Qdrant Cloud URL and API key are correct
  2. Network connectivity is fine
  3. The issue is within mem0's internal handling of the Qdrant client

Suspected Cause

Looking at the mem0-ts source code at src/oss/src/vector_stores/qdrant.ts, when a pre-configured client is passed, it should be used directly (lines 37-38). However, the "Illegal host" error suggests that somewhere in the mem0 codebase (possibly during embedding or other operations), a different Qdrant connection is being attempted with incorrect parameters.

Questions

  1. Is there a known working configuration for Qdrant Cloud with mem0 OSS (TypeScript)?
  2. Are there any examples of successful Qdrant Cloud integration in serverless environments?
  3. Could this be related to how mem0 internally reinitializes the vector store during add/search operations?

Workaround Attempted

I've tried all combinations of:

  • host + port + https: true
  • url parameter only
  • Pre-configured client vs direct config
  • With and without explicit port in URL

None of them work when going through mem0, but all work when using QdrantClient directly.

Related Issues

Would appreciate any guidance on how to properly configure Qdrant Cloud with mem0 OSS. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1-highBlocks significant use case, high demandbugSomething isn't workingsdk-typescriptTypeScript/Node.js SDK specific

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions