Issues with Typesense.Client in React Native
TLDR kurt is experiencing issues with Typesense.Client instantiation in React Native, despite correct imports and code. Jason couldn't identify immediate issues, but agreed to troubleshoot with a simplified reproduction app.
1
1
Aug 31, 2021 (29 months ago)
kurt
04:47 PM"TypeError: Cannot read property 'Client' of undefined".
I just try to get the client like in Step #2 of the Firebase docs
Jason
04:48 PMIn this case, did you already import or require the Typesense library?
kurt
04:49 PMJason
04:50 PMJason
04:50 PMkurt
04:51 PMimport React, { useEffect, useLayoutEffect, useState } from 'react';
import { HeaderBackButton, StackScreenProps } from '@react-navigation/stack';
import Typesense from 'typesense';
type ScreenProps = StackScreenProps<AppStackParamList, 'Explore'>;
let searchClient = new Typesense.Client({
nodes: [
{
host: '',
port: '443',
protocol: 'https'
}
],
apiKey: 'my-api-key',
connectionTimeoutSeconds: 2
});
export default function ExploreScreen({ navigation, route }: ScreenProps) {
...
}
kurt
04:53 PMkurt
04:55 PMtypesense": "^0.14.0,
Jason
04:56 PMkurt
05:00 PM@babel/runtime
too. Thanks for the quick replies in any case!kurt
05:02 PMIf you choose to use this extension, you can skip directly to Step 4 below, once you set up the extension.
and then at Step 4, the code shows to use client variable, but not showing how to get the client.
1
kurt
05:03 PMJason
05:03 PM1
Typesense
Indexed 3015 threads (79% resolved)
Similar Threads
Typescript Support and Import Issues with Typesense
Ahmad faced trouble with Typesense support for Typescript. Jason assisted by suggesting checks and solutions. Phil suggested modifying the import statement. Ultimately, the issue was resolved with a change from Jason in version `v1.1.2`.
Issues with Typesense Frontend Search Integration
Akash experienced issues integrating Typesense into their frontend search, particularly with their search box. Jason guided them to troubleshoot, eventually identifying the issue to be with react-instantsearch-dom and suggesting a downgrade to react 17, which resolved the issue.
Setup and Issues in Connecting Typesense Instance with Firebase Emulator
Michael.M seeks help on connecting a local Typesense instance to the Firebase local emulator. Jason suggests looking at emulator commands and creating a specific file. After various attempts and troubleshooting steps, Michael.M is able to establish the connection.
Resolving Issues with Firebase Extension and Typesense Configuration
Ernie sought clarification on how to handle the Firebase Extension and typesense collection configuration issues. Jason explained how to correctly specify the path and refresh the page to see updated data. After applying the advice given, Ernie successfully saw the changes.
Debugging Search Issue with Typesense Server Caching
Jameshwart reported experiencing caching issues with typesense server, despite the server's default setting of not caching. Through troubleshooting steps with Kishore Nallan, they were able to confirm an issue with the Typesense Javascript client and resolved it by adding `cacheSearchResultsForSeconds: 0` after `apiKey` in the initialisation. Laura also participated in discussion, learning about server and client level caching.