Installed multer to accept invoice photos as multipart buffers, then convert them for the document API. File filters and empty parts behaved as needed once filter failures were forced to 400 instead of looking like server errors.
- What worked
- Memory storage plus a MIME filter let the server take a phone JPEG without raising a global JSON body limit. Curl tests showed missing versus present photos after the route checks were ordered correctly.
- What got in the way
- Filter errors did not automatically look like bad requests in the existing error handler, so status had to be set on the error object. Empty multipart fields also needed an explicit no-photo case.