Open appdevhm88mt opened 6 days ago
Cannot destructure property 'originalname' of 'request.file' as it is undefined. TypeError: Cannot destructure property 'originalname' of 'request.file' as it is undefined.
at /workspaces/anything-llm_dev-container/server/endpoints/api/document/index.js:85:17
at Layer.handle [as handle_request] (/workspaces/anything-llm_dev-container/server/node_modules/express/lib/router/layer.js:95:5)
at next (/workspaces/anything-llm_dev-container/server/node_modules/express/lib/router/route.js:149:13)
at /workspaces/anything-llm_dev-container/server/utils/files/multer.js:72:5
at done (/workspaces/anything-llm_dev-container/server/node_modules/multer/lib/make-middleware.js:45:7)
at indicateDone (/workspaces/anything-llm_dev-container/server/node_modules/multer/lib/make-middleware.js:49:68)
at Multipart.<anonymous> (/workspaces/anything-llm_dev-container/server/node_modules/multer/lib/make-middleware.js:166:7)
at Multipart.emit (/workspaces/anything-llm_dev-container/server/lib/events.js:517:28)
at emitCloseNT (/workspaces/anything-llm_dev-container/server/lib/internal/streams/destroy.js:132:10)
at process.processTicksAndRejections (node:internal/process/task_queues:81:21) {stack: "TypeError: Cannot destructure property 'origi…ons (node:internal/process/task_queues:81:21)", message: "Cannot destructure property 'originalname' of 'request.file' as it is undefined."}
This certainly has to do with how Swagger file uploading works since it does not seem to be retaining the multipart data of the file object. Are you able to replicate this via tradional POST/Fetch request as opposed to using the Swagger UI only?
Hi, I can successfully use Postman to POST the request with file object. So it's Swagger issue?
Correct, this is only limited to the swagger UI, not the functionality of the endpoint itself.
How are you running AnythingLLM?
Docker (local)
What happened?
[BUG]: Try Swagger API POST /v1/document/upload with any file get 500 Error: Internal Server Error
Please see the attached error logs. v1-document-upload-error-logs.txt
Expect to get the success response
We have no this issue while using the AnytingLLM native workspace document upload feature
Are there known steps to reproduce?
See the failed screenshot as following:
](url)