#community-help

Fixing Corrupted Documents and Upgrading Typesense Cloud Version

TLDR gab had issues with corrupted documents in Typesense Cloud. Jason suggested upgrading to version 0.24.1.rc, which resolved the issue. They also discussed CORS domain management.

Powered by Struct AI

2

1

30
7mo
Solved
Join the chat
Mar 16, 2023 (7 months ago)
gab
Photo of md5-8be2a24edf7a95c9c74abce4b1130c3e
gab
01:17 PM
Hi,
I have a basic collection of cities in Typesense cloud.
It seems I have at least one or two corrupted documents stored.
I got this exception whenever I try to group them: TypeError: Cannot read properties of null (reading 'id')
In case I do not group them I can also see the page display less results than the results found.

Here is the multisearch result
grouped_hits: [{group_key: [], hits: [{document: null}]},…]

Here is the error locally in my machine, but the same happen in Typesense cloud, except the error comes from the minized bundle.
client.js?ab48:1 TypeError: Cannot read properties of null (reading 'id')
    at eval (SearchResponseAdapter.js?8188:58:1)
    at Array.map (<anonymous>)
    at SearchResponseAdapter._adaptHits (SearchResponseAdapter.js?8188:55:1)
    at eval (SearchResponseAdapter.js?8188:41:1)
    at Array.map (<anonymous>)
    at SearchResponseAdapter._adaptGroupedHits (SearchResponseAdapter.js?8188:40:1)
    at SearchResponseAdapter.adapt (SearchResponseAdapter.js?8188:173:1)
    at eval (TypesenseInstantsearchAdapter.js?2572:70:1)
    at Array.map (<anonymous>)
    at TypesenseInstantsearchAdapter._callee$ (TypesenseInstantsearchAdapter.js?2572:66:1)
    at tryCatch (regeneratorRuntime.js?8727:44:1)
    at Generator.eval (regeneratorRuntime.js?8727:125:1)
    at Generator.eval [as next] (regeneratorRuntime.js?8727:69:1)
    at asyncGeneratorStep (asyncToGenerator.js?af4f:3:1)
    at _next (asyncToGenerator.js?af4f:22:1)

How could I troubleshoot that ?

Thanks for help
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
04:19 PM
Could you share a screenshot of the “search parameters” section in Typesense Cloud?
gab
Photo of md5-8be2a24edf7a95c9c74abce4b1130c3e
gab
04:21 PM
Image 1 for
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
04:24 PM
Could you DM me your cluster ID as well?
04:26
Jason
04:26 PM
Could you share the query term you used as well?
04:26
Jason
04:26 PM
(I’m essentially trying to replicate the issue on my end)
gab
Photo of md5-8be2a24edf7a95c9c74abce4b1130c3e
gab
04:27 PM
lanc
04:31
gab
04:31 PM
The issue can be seen also with only: queryBy: city &amp;&amp; q=lanc
The warning won't be here but the displayed results are 2 on 4 results
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
04:31 PM
It seems like there’s a document that’s corrupted somehow on disk:
Image 1 for It seems like there’s a document that’s corrupted somehow on disk:
04:32
Jason
04:32 PM
The UI expects at least the ID field to show up in a document, since Typesense auto-generates it if one is not sent in the document
04:32
Jason
04:32 PM
So this is throwing things off
gab
Photo of md5-8be2a24edf7a95c9c74abce4b1130c3e
gab
04:32 PM
Is there a mean to get its id to delete it ?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
04:32 PM
You’re currently running 0.23.0.rc27… and I vaguely remember fixing some related issues in more recent builds. Can we upgrade you to the latest 0.24.1.rc?
gab
Photo of md5-8be2a24edf7a95c9c74abce4b1130c3e
gab
04:33 PM
Is there any changelog I should read before or there should not be any breaking things between those version ?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
04:34 PM
These are the two changelogs I’d recommend reviewing:

https://typesense.org/docs/0.23.1/api/
https://typesense.org/docs/0.24.0/api/

0.24.1 just has some bug fixes from 0.24.0
gab
Photo of md5-8be2a24edf7a95c9c74abce4b1130c3e
gab
04:38 PM
There are some stuff to check. I will try locally this version first and DM you if it is fine for you ?
Thanks
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
04:41 PM
Sure
gab
Photo of md5-8be2a24edf7a95c9c74abce4b1130c3e
gab
05:24 PM
All good, Shall I trigger a snapshot before you trigger the version upgrade ? I'm not so sure of the procedure on Typesense Cloud
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:33 PM
We do that automatically on our side when we upgrade
05:33
Jason
05:33 PM
I’ll queue up the upgrade now
gab
Photo of md5-8be2a24edf7a95c9c74abce4b1130c3e
gab
05:33 PM
Ok thanks
05:33
gab
05:33 PM
One more thing
05:33
gab
05:33 PM
How can I manage cors domain
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:34 PM
In Typesense Cloud, we set it to * and we don’t allow that to be configurable
05:34
Jason
05:34 PM
(Mainly because it can be easily spoofed by users using direct curl requests)
gab
Photo of md5-8be2a24edf7a95c9c74abce4b1130c3e
gab
05:41 PM
Ok I see 👍
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:49 PM
The upgrade is now complete. Looks like the issue is now fixed…
gab
Photo of md5-8be2a24edf7a95c9c74abce4b1130c3e
gab
05:49 PM
Ok perfect the migration fixed it .D

1

05:49
gab
05:49 PM
Thanks a lot

1