Shiva Dixith
01/28/2025, 4:02 AMawait client.collections(collectionName).documents().import(docs, {
action: 'emplace',
return_id: true,
dirty_values: 'coerce_or_reject',
});
When I run the code on our dev server(which has both the indexing nodejs server and the typesense server running), indexing starts to fail randomly after around 10-12 batches(for all subsequent batches) with RequestMalformed 400 error. It happens really fast, almost in the blink of an eye.
However, when I run this on my local machine(connecting it to the same typesense server running on our dev server ), indexing works absolutely fine. I can see the batches are being processed a little slower here(on the nodejs server running on my local machine).
Now in both cases, the code and data are the same. And I do not see this issue with our production typesense cluster yet.
Related logs :
What I see in typesense.log(for the duration of indexing of all batches) :
I20250127 10:20:01.153842 838508 raft_server.h:60] Peer refresh succeeded!
I20250127 10:20:10.584830 838502 collection.cpp:5039] Collection site_content_11 is being prepared for alter...
I20250127 10:20:10.585074 838502 collection.cpp:5067] Alter payload validation is successful...
I20250127 10:20:10.585126 838502 collection.cpp:4986] Finished altering 0 document(s).
I20250127 10:20:11.154877 838493 raft_server.cpp:693] Term: 53, pending_queue: 0, last_index: 2769909, committed: 2769909, known_applied: 2769909, applying: 0, pending_writes: 0, queued_writes: 428, local_sequence: 471962177
I20250127 10:20:11.155035 838508 raft_server.h:60] Peer refresh succeeded!
I20250127 10:20:11.597046 838502 collection.cpp:5039] Collection site_content_11 is being prepared for alter...
I20250127 10:20:11.597399 838502 collection.cpp:5067] Alter payload validation is successful...
I20250127 10:20:11.597494 838502 collection.cpp:4986] Finished altering 0 document(s).
I20250127 10:20:21.156010 838493 raft_server.cpp:693] Term: 53, pending_queue: 0, last_index: 2769922, committed: 2769922, known_applied: 2769922, applying: 0, pending_writes: 0, queued_writes: 428, local_sequence: 471963644
I20250127 10:20:21.156138 838508 raft_server.h:60] Peer refresh succeeded!
What I see on our application error logs for every batch after 10-12 batches( me just JSON.stringifying the error object in the catch block) :
2025-01-27 10:03:14 -08:00: index-server:prod:indexer: Indexing 40 items to site_content_11
2025-01-27 10:03:14 -08:00: index-server:prod:indexer: === error indexer.ts [38] === {
2025-01-27 10:03:14 -08:00: index-server:prod:indexer: "name": "RequestMalformed",
2025-01-27 10:03:14 -08:00: index-server:prod:indexer: "httpStatus": 400
2025-01-27 10:03:14 -08:00: index-server:prod:indexer: }
Question : Is this some sort of race condition that I need to factor in my code ? I can't see any other issue with this.Kishore Nallan
01/28/2025, 4:43 AMShiva Dixith
01/28/2025, 4:45 AMKishore Nallan
01/28/2025, 4:46 AMShiva Dixith
01/28/2025, 4:49 AMFanis Tharropoulos
01/28/2025, 12:48 PMdocuments failed during import. Use \error.importResults\
from the raised exception to get a detailed error reason for each document.`Shiva Dixith
01/28/2025, 1:08 PMFanis Tharropoulos
01/28/2025, 1:49 PMFanis Tharropoulos
01/29/2025, 8:53 AMhttpBody
attribute in any instance of a child of TypesenseError
. The 400 Request Malformed
is one of them, so try accessing it on thatShiva Dixith
01/30/2025, 6:28 PMFanis Tharropoulos
01/31/2025, 8:09 AMShiva Dixith
01/31/2025, 8:09 AMFanis Tharropoulos
01/31/2025, 8:13 AMShiva Dixith
01/31/2025, 8:16 AMFanis Tharropoulos
01/31/2025, 8:18 AMShiva Dixith
01/31/2025, 8:18 AMFanis Tharropoulos
01/31/2025, 8:26 AMShiva Dixith
01/31/2025, 8:45 AMShiva Dixith
01/31/2025, 12:06 PMFanis Tharropoulos
01/31/2025, 12:29 PM