diff --git a/app/lib/actions/billActions.ts b/app/lib/actions/billActions.ts index 89a22fb..2ebb595 100644 --- a/app/lib/actions/billActions.ts +++ b/app/lib/actions/billActions.ts @@ -150,7 +150,9 @@ export const updateOrAddBill = withUser(async (user:AuthenticatedUser, locationI // update the bill in the mongodb const dbClient = await getDbClient(); - const billAttachment = await serializeAttachment(formData.get('billAttachment') as File); + const billAttachmentFile = formData.get('billAttachment') as File; + const billAttachment = billAttachmentFile && billAttachmentFile.size > 0 ? + await serializeAttachment(billAttachmentFile) : null; if(billId) {