#community-help

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

Jan 31, 2023 (10 months ago)
Nikunj
Photo of md5-e86f551204439999ca28639ea0e038b0
Nikunj
05:00 AM
hey good morning ,
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
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:01 AM
If this is in the JS / TS client, it should be const client = new Typesense.Client({...})
05:01
Jason
05:01 AM
You’re missing the new keyword
Nikunj
Photo of md5-e86f551204439999ca28639ea0e038b0
Nikunj
05:03 AM
thanks that worked for me/

1