SSD Duplicate book create issue

TypeError: Cannot read properties of undefined (reading ‘_id’) at C:\Users\DELL\neutrinos-studio\backendapp\server\node_modules\mongodb\lib\operations\common_functions.js:64:17 at Array.map () at prepareDocs (C:\Users\DELL\neutrinos-studio\backendapp\server\node_modules\mongodb\lib\operations\common_functions.js:63:17) at new InsertOneOperation (C:\Users\DELL\neutrinos-studio\backendapp\server\node_modules\mongodb\lib\operations\insert.js:42:74) at Collection.insertOne (C:\Users\DELL\neutrinos-studio\backendapp\server\node_modules\mongodb\lib\collection.js:150:78) at MongoPersistance.insertOne (file:///C:/Users/DELL/neutrinos-studio/backendapp/server/src/utils/ndefault-mongodb/Mongodb/MongoPersistance.ts:86:46) at create_book.createBook (file:///C:/Users/DELL/neutrinos-studio/backendapp/server/src/sd-services/book/create_book.ts:173:74) at create_book.existQuery (file:///C:/Users/DELL/neutrinos-studio/backendapp/server/src/sd-services/book/create_book.ts:162:29) at create_book.existingCheck (file:///C:/Users/DELL/neutrinos-studio/backendapp/server/src/sd-services/book/create_book.ts:129:29) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

when duplicate book create time showing this error instead of message?

@Eldho @Sam @Simphiwe

1 Like

Hello @mohammedrimshan ,
You can add a Catch node in your flow to handle this error gracefully and return a proper message instead of showing a crash.

Also, please make sure to log the book data before calling insertOne() so we can verify whether it’s being passed as undefined. This will help confirm if the duplicate check is returning no data

3 Likes