FlowiseAI / Flowise

Drag & drop UI to build your customized LLM flow
https://flowiseai.com
Apache License 2.0
31.71k stars 16.54k forks source link

[BUG] Paths for file uploads are hard coded #3510

Open graipher opened 1 week ago

graipher commented 1 week ago

Describe the bug Flowise uses a hard coded folder path for some file uploads. This breaks on read-only file systems and cannot be configured.

To Reproduce Steps to reproduce the behavior:

  1. Try to run flowise in a read-only file system
  2. See error
Error: EROFS: read-only file system, mkdir
'/usr/local/lib/node_modules/flowise/uploads'
Code: EROFS

Expected behavior File uploads should respect the storage settings passed in via env variables (ie either BLOB_STORAGE_PATH if using local storage or the S3_* variables).

Setup

Additional context Hardcoded paths are here:

And multer will try to create the destination directory if passed as a string and if it does not exist:

Note: You are responsible for creating the directory when providing destination as a function. When passing a string, multer will make sure that the directory is created for you. https://www.npmjs.com/package/multer#diskstorage

There seems to already be some functionality for getting the right paths elsewhere: https://github.com/FlowiseAI/Flowise/blob/d0571291b76883a60cec7a004069a4175647172c/packages/server/src/controllers/get-upload-path/index.ts#L4

HenryHengZJ commented 1 week ago

Yep, I think we should definitely change the hard coded multer path to either whatever env variables that was set, if not, default to the hard coded path