TypeError: weaviate.connectToWCS is not a function

Description

I am attempting to use weaviate-client in my nodejs application and followed Weaviate’s documentation

Unfortunately, their sample code doesn’t seem to work for me at all.

import weaviate from 'weaviate-client'

const search = async () => {
    const client = await weaviate.connectToWCS(
        MY_WEAVIATE_URL, { 
          authCredentials: new weaviate.ApiKey(MY_API_KEY), 
          headers: {
            'X-OpenAI-Api-Key': MY_OPENAI_API_KEY,
          }
        } 
      )

    console.log(client)
}

search()

The error that I’ve been receiving is TypeError: weaviate.connectToWCS is not a function. Am I missing something?

Server Setup Information

I’m using “weaviate-client”: “^3.0.0-rc.4”

  • Client Language and Version: nodejs v21

Any additional Information

I have “type”: “module” in my package.json

Hi! Welcome to our community!

How have you installed the client?

Note that the way to install it, as described in the doc is:

npm install weaviate-client --tag next

This is the output when I run

npm list | grep weaviate
❯ npm list | grep weaviate
lab@ /Users/dudanogueira/dev/weaviate/lab
+-- weaviate-client@3.0.0-rc.4
`-- weaviate-ts-client@2.1.1

Let me know if this helps.

I have installed as per the documentation’s instruction.

This is what I see when i run the grep

npm list | grep weaviate
└── weaviate-client@3.0.0-rc.4

Hi @jrkoh,

We are just going through the final update to the Weaviate client, where we introduced a breaking change.

connectToWCS() is now connectToWCD
like this:

import weaviate from 'weaviate-client'

const search = async () => {
    const client = await weaviate.connectToWCD(
        MY_WEAVIATE_URL, { 
          authCredentials: new weaviate.ApiKey(MY_API_KEY), 
          headers: {
            'X-OpenAI-Api-Key': MY_OPENAI_API_KEY,
          }
        } 
      )

    console.log(client)
}

search()

GA coming soon

The GA of the new client will land later this week, so there shouldn’t be any more surprises (breaking changes :pray:).

I hope that you didn’t get too discouraged.

Docs update

We are working on the final docs updates, which should fix all the missing changes.

Let me know if I can help.

2 Likes

Thanks @sebawita.

I’ll wait for the GA updates to land by the end of this week and give it another go sometime next week. Hopefully all goes well.

1 Like