[BUG] MySQL - Chat flow JSON data is truncated if more than 65,535 characters
Describe the bug
When using MySQL database, the flowData column in the chat_flow table only supports up to a maximum of 65,535 characters. Values greater than this length are truncated. The column flowData column stores JSON data and when it's truncated, an error in the browser Uncaught SyntaxError: Unterminated string in JSON at position 65535 is thrown because the data is incomplete.
This issue only happens when using MySQL database, SQLite and Postgres works just fine.
To Reproduce
- Use MySQL as a database (
DATABASE_TYPE=mysql) - Log in to Flowise and create a new Chatflow
- Add nodes as much as you can until the size of the Chatflow JSON reaches more than 65,535 characters
- Save Chatflow
- Go back to the main page
- Open the Chatflow you created in step 3
Expected behavior It should load the Chatflow/canvas.
Screenshots
Setup
- Installed with Docker
- Flowise Version 1.6.4 (docker.io/flowiseai/flowise:1.6.4)
- OS: Linux
- Browser: Google Chrome
Additional context
- Maximum length of the
TEXTdata type in MySQL is documented here https://dev.mysql.com/doc/refman/8.3/en/string-type-syntax.html
A variable-length string. M represents the maximum column length in characters. The range of M is 0 to 65,535. The effective maximum length of a VARCHAR is subject to the maximum row size (65,535 bytes, which is shared among all columns) and the character set used
- I'm using Postgres database as an alternative solution because Postgres'
TEXTdata type can store much larger amount of data https://www.postgresql.org/docs/9.6/datatype-character.html.