fix: handle empty/whitespace LOG_PATH in docker compose#6031
fix: handle empty/whitespace LOG_PATH in docker compose#6031haroldfabla2-hue wants to merge 1 commit intoFlowiseAI:mainfrom
Conversation
When LOG_PATH is set to an empty string in docker-compose (e.g.
LOG_PATH=${LOG_PATH} with unset LOG_PATH), mkdirSync('') fails
with ENOENT error.
Fix: use optional chaining + trim + || instead of ??
to properly handle empty strings and whitespace-only values.
Fixes FlowiseAI#6030
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical startup failure in the Flowise container when the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses a startup failure that occurs when the LOG_PATH environment variable is set to an empty string. The proposed change correctly handles undefined, null, empty, and whitespace-only values for LOG_PATH by using a default directory as a fallback. The implementation is clean, idiomatic, and effectively resolves the bug.
Summary
When
LOG_PATHis set to an empty string in docker-compose (e.g.LOG_PATH=${LOG_PATH}with an unsetLOG_PATHenv var), the Flowise container fails to start with:Root Cause
In
packages/server/src/utils/config.ts, the nullish coalescing operator??only handlesundefinedandnull, but NOT empty strings:When
LOG_PATH=(empty string),??returns""->mkdirSync("")fails.Fix
Use optional chaining + trim + logical OR to properly handle empty strings and whitespace-only values:
This ensures that:
undefined-> uses defaultnull-> uses default""(empty) -> uses default" "(whitespace) -> uses default"/valid/path"-> uses provided pathTesting
LOG_PATH=(empty) -> uses default./logsLOG_PATH=" "(whitespace) -> uses defaultLOG_PATH=/my/path-> uses provided pathFixes #6030