Skip to content

Commit 6bc511b

Browse files
authored
Merge pull request #116 from tharropoulos/err-import
fix(backfill): return the id of the failed document on backfill errors
2 parents d2b1e7c + e62690b commit 6bc511b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

functions/src/backfill.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ module.exports = onDocumentWritten("typesense_sync/backfill", async (snapshot, c
9090

9191
lastDoc = thisBatch.docs.at(-1) ?? null;
9292
try {
93-
await typesense.collections(encodeURIComponent(config.typesenseCollectionName)).documents().import(currentDocumentsBatch, {action: "upsert"});
93+
await typesense.collections(encodeURIComponent(config.typesenseCollectionName)).documents().import(currentDocumentsBatch, {action: "upsert", return_id: true});
9494
info(`Imported ${currentDocumentsBatch.length} documents into Typesense`);
9595
} catch (err) {
9696
error(`Import error in a batch of documents from ${currentDocumentsBatch[0].id} to ${lastDoc.id}`, err);

0 commit comments

Comments
 (0)