weaviate / typescript-client

Official Weaviate TypeScript Client
https://www.npmjs.com/package/weaviate-ts-client
BSD 3-Clause "New" or "Revised" License
57 stars 21 forks source link

Docs need updating to reflect api key requirements in ^3.0.0-beta.23 #137

Closed gregbayer closed 1 month ago

gregbayer commented 1 month ago

The V3 docs say the api key should be passed as a string when connecting in custom mode. See here:

https://weaviate.io/developers/weaviate/client-libraries/typescript/typescript-v3


const client = await weaviate.client({
    rest: {
      host: 'WEAVIATE_INSTANCE_HOST_NAME',
      port: 8080,
      secure: true
    },
    grpc: {
      host: 'WEAVIATE_INSTANCE_HOST_NAME',
      port: 50051,
      secure: true
    },
    auth: {
      apiKey: process.env.WEAVIATE_API_KEY || ''
    },
    headers: {
      'X-OpenAI-Api-Key': process.env.OPENAI_API_KEY || ''
    }
  }
)

console.log(client)

However, I was only able to get the client to connect when wrapping the api key string like this. Otherwise the client validation code drops the key.

auth: {
  apiKey: new weaviate.ApiKey(process.env.WEAVIATE_API_KEY || '')
}
tsmith023 commented 1 month ago

Hi @gregbayer, thanks for calling this one out! I think this is a regression so I'll add back support for detecting a string as an API key in the next RC release

tsmith023 commented 1 month ago

Fixed in v3.0.0-rc.3