SyntaxError: Unexpected token o in JSON at position 1
petermasica opened this issue · comments
Hi, I added some logs to your get function and found out the following.
mariadb 10.9.2
The session data surprisingly comes already parsed data: { cookie: [Object], user: [Object] }
and thus the parsing results in the error below.
SyntaxError: Unexpected token o in JSON at position 1
at JSON.parse ()
at /usr/src/app/node_modules/connect-session-sequelize/lib/connect-session-sequelize.js:88:25
at processTicksAndRejections (node:internal/process/task_queues:96:5)
mariadb 10.4
It works fine with this mariadb version. The session data comes as JSON data: '{"cookie":{...},"user":{...}}'
a thus the parsing doesn't throw any error.
PS: I started experiencing the issue after updating the data
column of the sessions
table to JSON
.
Resolved the issue by changing the data
column of the sessions
table to TEXT
data type.