Typesense js client upgrade: API key and SearchClient issues
TLDR Janaka had issues with the API key showing in the query string after upgrading the Typesense js client and noticed a change in the retrieve()
method's behavior. Jason explained the change and advised on the API key issue, asking Janaka to create a Github issue for it which was done.
1
Jan 15, 2022 (24 months ago)
Janaka
02:49 PMfalse
)My app broke 😅. The cause a breaking change in the client lib API introduced in v1.0.0-3. Seems like this change. I'm unblocked now but thought I'd share some details and check if I'm missing somewhere that tracks the js client API changes? it doesn't seen to mirror what on the docs site.
Since then
collection('mycollectionname').retrieve()
returns a different type. It used to return as per the docs here. I'm using the SearchClient
and accessing the num_documents
property. In the PR I see references to a SearchOnlyCollection. I've not managed to find docs for this type. Am I missing something?Janaka
02:55 PMon js client v1.1.3-0 it's still doing it. In code I see the default is supposed to be
false
. Even when the client instantiation config has sendApiKeyAsQueryParam: false,
Jason
04:50 PMSearchClient
does not expose a collection('name').retrieve()
method. It is meant to only allow searches on documents.If you use
Client
instead, you should see num_documents
like this:Jason
04:51 PMJason
04:57 PMThat almost sounds like a bug... Could you open a Github issue for this? I think we should respect the config passed into the config
Janaka
04:59 PMJason
05:00 PMJason
05:01 PMClient has all the methods that Typesense supports
Janaka
09:55 PMJan 16, 2022 (24 months ago)
Typesense
Indexed 3015 threads (79% resolved)
Similar Threads
Resolving Typesense Server Connection with Correct API Keys and Paths
Rubai had trouble creating a working API key for Typesense and understanding number_hits versus num_documents. Jason provided clarification and correct code for generating a search-only API Key and using correct server configurations.
Resolving Issues with Scoped API Keys in Typesense with Golang
Suvarna had problems with generating and using scoped API keys in Typesense with Golang. Several bugs misleading the user were found and fixed by Kishore Nallan.
Issues with Generating Scope API Keys in Python
Danny had issues generating a valid scope API key in a Python GraphQL server. Jason suggested encoding changes and confirmed that the key length varies. Issue unresolved with Python, although JS library worked.
Trouble Spotting API Error in Dart vs Shell Operations
Erick is having issues with the typesense API, receiving errors in Dart that are not present in shell operations. Despite Kishore Nallan trying to help, no solution has been found, leading Erick to post the issue on the dart client repository.
Troubleshooting Typesense Document Update Error
Mehdi had an issue with updating Typesense documents which returned a '404 Not Found' error. Kishore Nallan after several debugging steps, discovered Mehdi was using an outdated Typesense version. The issue was resolved after upgrading Typesense.