Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Unexpected token o in JSON at position 1 #139

Closed
petermasica opened this issue Sep 19, 2022 · 1 comment
Closed

SyntaxError: Unexpected token o in JSON at position 1 #139

petermasica opened this issue Sep 19, 2022 · 1 comment

Comments

@petermasica
Copy link

petermasica commented Sep 19, 2022

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.

@petermasica
Copy link
Author

Resolved the issue by changing the data column of the sessions table to TEXT data type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant