typescript-client icon indicating copy to clipboard operation
typescript-client copied to clipboard

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

Open gregbayer opened this issue 1 year ago • 1 comments
trafficstars

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 || '')
}

gregbayer avatar May 08 '24 01:05 gregbayer

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 avatar May 13 '24 10:05 tsmith023

Fixed in v3.0.0-rc.3

tsmith023 avatar May 22 '24 09:05 tsmith023