chill117 / express-mysql-session

A MySQL session store for the express framework in node
MIT License
313 stars 106 forks source link

Incorrect string value #128

Closed MadKilzz closed 1 year ago

MadKilzz commented 3 years ago

When i make a session i get an error Error: ER_TRUNCATED_WRONG_VALUE_FOR_FIELD: Incorrect string value: '\xF0\x9F\xA6\x95",...' for column 'data' at row 1

i use the default options:

var sessionStore = new MySQLStore({
    createDatabaseTable: true,
    schema: {
        tableName: 'sessions',
        columnNames: {
            session_id: 'session_id',
            expires: 'expires',
            data: 'data'
        }
    }
}, sql);
chill117 commented 3 years ago

Looks like you're trying to save session data that includes characters not included in the utf8 encoding.

MadKilzz commented 3 years ago

Looks like you're trying to save session data that includes characters not included in the utf8 encoding.

How can i fix it? i use express session with discord oauth2 (paspoort-discord) look liks there is not a characters what not is supported

chill117 commented 3 years ago

Looks like the following stackoverflow post could help you: https://stackoverflow.com/questions/20411440/incorrect-string-value-xf0-x9f-x8e-xb6-xf0-x9f-mysql

You might need to change a MySQL configuration so that it's using the "utf8mb4_general_ci" or "utf8mb4_bin" encoding.

chill117 commented 1 year ago

Closing this as it's likely been solved.