Flowise icon indicating copy to clipboard operation
Flowise copied to clipboard

[BUG] MySQL - Chat flow JSON data is truncated if more than 65,535 characters

Open sarenodev opened this issue 1 year ago • 0 comments

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

  1. Use MySQL as a database (DATABASE_TYPE=mysql)
  2. Log in to Flowise and create a new Chatflow
  3. Add nodes as much as you can until the size of the Chatflow JSON reaches more than 65,535 characters
  4. Save Chatflow
  5. Go back to the main page
  6. Open the Chatflow you created in step 3

Expected behavior It should load the Chatflow/canvas.

Screenshots image

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 TEXT data 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' TEXT data type can store much larger amount of data https://www.postgresql.org/docs/9.6/datatype-character.html.

sarenodev avatar Apr 11 '24 15:04 sarenodev