Solving An Issue with Typesense-js in Sveltekit Production
TLDR Francois reported an issue where a static value in typesense-js was undefined in Sveltekit's production. Jason helped debug the issue, suspecting a build problem or a circular dependency. Francois's solution eliminated this error and was tested, approved, and finally merged by Jason.



Jan 06, 2022 (20 months ago)
Francois
08:16 PMFrancois
08:18 PMThe line in question is here, on
Documents.RESOURCEPATH
: https://github.com/typesense/typesense-js/blob/master/src/Typesense/SearchOnlyDocuments.ts#L38Francois
08:20 PM1-
Documents.RESOURCEPATH
was null because Documents
extends SearchOnlyDocument
and static getter are not properly extended, but then it would seem TypeScript should detect that and fail2- The circular dependency between
./Documents.ts
and ./SearchOnlyDocuments.ts
is causing some issues at build-time by ViteFrancois
08:20 PMJason
08:21 PMDocuments.RESOURCEPATH
being definedJason
08:21 PMFrancois
08:21 PMDocuments.RESOURCEPATH
was super important here, and I don't know about the in-and-outs enough 😛Jason
08:22 PMFrancois
08:23 PMdefault
, so I'm wondering if this is a Vite issue instead (since it works properly in dev mode)Jason
08:24 PMconst RESOURCEPATH = '/documents'
is defined in SearchOnlyDocuments
which Documents
extends.Jason
08:25 PMDocuments.RESOURCEPATH
actually comes from SearchOnlyDocuments.RESOURCEPATH
Jason
08:25 PMJason
08:27 PMFrancois
08:28 PM./Documents
imports ./SearchOnlyDocuments
and ./SearchOnlyDocuments
imports ./Documents
🤔Francois
08:29 PMJason
08:31 PMJason
08:31 PMJason
08:34 PMFrancois
08:40 PMThe only thing I can see that wouldn't work with my fix is if people used to do something like
typesensemodule.Documents.RESOURCEPATH = '/somethingelse'
, it would not be taken into account in SearchOnlyDocuments
, but I hope people are not doing this 😂Jason
08:41 PMFrancois
08:43 PMFrancois
08:44 PMJason
08:45 PM
Jason
08:56 PM1.1.3-0
. Could you give it a shot now?

Jan 07, 2022 (20 months ago)
Francois
01:31 PMJason
02:17 PMTypesense
Indexed 2764 threads (79% resolved)
Similar Threads
Typesense-JS Client Types Importation Problem.
Stefan had problems importing types from typesense-JS, causing compiler slowdowns. Jason and Damian provided guidance and agreed to export necessary types from Typesense.ts, improving import speed and reducing compiler checks.
Handling Kinesis Stream Event Batching with Typesense
Dui had questions about how to handle Kinesis stream events with Typesense. Kishore Nallan suggested using upsert mode for creation/update and differentiating with logical deletion. After various discussions including identifying and resolving a bug, they finalized to introduce an `emplace` action in Typesense v0.23.


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`.
Troubleshooting TypeScript Error with Typesense
GM experienced an error with Typesense in TypeScript, requiring help to correct the issues. Jason helped propose solutions and adjustments to the code. Ultimately, they were able to resolve the errors and successfully implement a search function.


Troubleshooting Issues with DocSearch Hits and Scraper Configuration
Rubai encountered issues with search result priorities and ellipsis. Jason helped debug the issue and suggested using different versions of typesense-docsearch.js, updating initialization parameters, and running the scraper on a Linux-based environment. The issues related to hits structure and scraper configuration were resolved.


