Typesense.js Client and SearchOnlyClient Confusion

TLDR After resolving an initial connection issue, Darren queried about his inability to use the 'upsert' method in Typesense.js. Jason suggested he might be using the wrong client.

Powered by Struct AI
Dec 14, 2021 (25 months ago)
Photo of md5-fa83de4db3e1444aecaf7a587e35eb16
11:08 PM
Jason Thanks for the the reply and the offer to help. But I figured it out - when I copied the host from the config, the last character was cut off, leading to an invalid host - so the CORS error was a red herring. I can connect and read now.

Although I'm not yet able to write docs to a collection - using the Admin API Key from the downloaded keys file within a Firebase Function, I can create a client, but I cannot upsert docs - the upsert method doesn't exist on the documents() object. In the debugging there is a class SearchOnlyDocuments - is this a collection configuration issue/parameter or this related to the APIKey? (even though I'm using the Admin API Key)
Photo of md5-8813087cccc512313602b6d9f9ece19f
11:11 PM
Got it.

It sounds like you might be using the SearchOnlyClient from typesense.js. You want to use Client