typesense / typesense-website

Typesense website and documentation | An open source search engine alternative to Algolia, Elasticsearch and Pinecone
https://typesense.org
39 stars 134 forks source link

Wrong example for Typesense Cloud with HA #238

Closed mboudreau closed 3 months ago

mboudreau commented 3 months ago

Description

The javascript configuration is wrong in the example on this page:

const Typesense = require('typesense')

let client = new Typesense.Client({
  'nearestNode': { 'host': 'xxx.a1.typesense.net', 'port': '443', 'protocol': 'https' }, // This is the special Nearest Node hostname that you'll see in the Typesense Cloud dashboard if you turn on Search Delivery Network
  'nodes': [
    { 'host': 'xxx-1.a1.typesense.net', 'port': '443', 'protocol': 'https' },
    { 'host': 'xxx-2.a1.typesense.net', 'port': '443', 'protocol': 'https' },
    { 'host': 'xxx-3.a1.typesense.net', 'port': '443', 'protocol': 'https' },
  ],
  'apiKey': '<API_KEY>',
  'connectionTimeoutSeconds': 2
})

If you're using typescript, it will throw an error saying that the type of port is wrong for the nodes and should be a number. Looking at the javascript directly seems to not be affected by this as it's being used in a .concat operation so it'll cast it to string no matter what, but still, either the example is wrong or the type is wrong. I think it's the former.

jasonbosco commented 3 months ago

Thank you for catching that. Just fixed it