Connection Issue with Typesense in JS/TS Client
TLDR Nikunj had trouble connecting to Typesense due to an undefined client. Jason solved it by suggesting the addition of the new
keyword.
Powered by Struct AI
1
4
10mo
Jan 31, 2023 (10 months ago)
Nikunj
Nikunj
05:00 AMhey good morning ,
I am trying to connect to typesense but i dont know what is wrong client is coming undefined.
const client = Typesense.Client({
nodes: [
{
host: '',
port: '443',
protocol: 'https',
}
],
apiKey: 'qtnBzpqaAo9xcndWaUR9GoHG8zhKAysU',
connectionTimeoutSeconds: 5,
})
I am trying to connect to typesense but i dont know what is wrong client is coming undefined.
Jason
Jason
05:01 AMIf this is in the JS / TS client, it should be
const client = new Typesense.Client({...})
05:01
Jason
05:01 AMYou’re missing the
new
keywordNikunj
Nikunj
05:03 AMthanks that worked for me/
1
Typesense
Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI
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`.
24
25mo
Issues with TypesenseClient Import in Typescript
David struggled to find correct import syntax for TypesenseClient in TypeScript, and Jason clarified the proper usage. The documentation for the import will now be updated.
10
2mo
Using TypeScript with Typesense JS Library
michtio asked how to use TypeScript with Typesense JS library, and Ross provided detailed example code.
3
17mo