chill117 / express-mysql-session

A MySQL session store for the express framework in node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexpected end of JSON input

enzotorrs opened this issue · comments

Hi, I'm having a uncommon error like this issue this issue.
I can't find where in my code this error trigger.

error:

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Query.<anonymous> (/home/enzotorrs/source/globo/api-jack/node_modules/express-mysql-session/index.js:185:18)
    at Query.<anonymous> (/home/enzotorrs/source/globo/api-jack/node_modules/underscore/underscore-node-f.cjs:1213:19)
    at Query.<anonymous> (/home/enzotorrs/source/globo/api-jack/node_modules/mysql/lib/Connection.js:526:10)
    at Query._callback (/home/enzotorrs/source/globo/api-jack/node_modules/mysql/lib/Connection.js:488:16)
    at Query.Sequence.end (/home/enzotorrs/source/globo/api-jack/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)
    at Query._handleFinalResultPacket (/home/enzotorrs/source/globo/api-jack/node_modules/mysql/lib/protocol/sequences/Query.js:149:8)
    at Query.EofPacket (/home/enzotorrs/source/globo/api-jack/node_modules/mysql/lib/protocol/sequences/Query.js:133:8)
    at Protocol._parsePacket (/home/enzotorrs/source/globo/api-jack/node_modules/mysql/lib/protocol/Protocol.js:291:23)
    at Parser._parsePacket (/home/enzotorrs/source/globo/api-jack/node_modules/mysql/lib/protocol/Parser.js:433:10)

package.json

{
"dependencies": {
    "aws-sdk": "^2.1121.0",
    "axios": "^0.27.0",
    "base64-arraybuffer": "^1.0.2",
    "bcrypt": "^5.0.1",
    "body-parser": "~1.20.0",
    "compression": "^1.7.4",
    "config": "^3.3.7",
    "cookie-parser": "~1.4.6",
    "cors": "^2.8.5",
    "debug": "~4.3.4",
    "ejs": "~3.1.7",
    "elasticsearch": "^16.7.2",
    "express": "^4.18.0",
    "express-mysql-session": "^2.1.7",
    "express-session": "^1.17.2",
    "joi": "^17.6.0",
    "jsonwebtoken": "^8.5.1",
    "jwk-to-pem": "^2.0.5",
    "mimemessage": "^1.0.5",
    "mobile-detect": "^1.4.5",
    "moment-timezone": "^0.5.34",
    "morgan": "^1.10.0",
    "multer": "^1.4.4",
    "mysql": "^2.18.1",
    "mysql2": "^2.3.3",
    "node-xlsx": "^0.21.0",
    "passport": "^0.5.2",
    "passport-oauth2": "^1.6.1",
    "querystring": "^0.2.0",
    "ramda": "^0.28.0",
    "sequelize": "^6.19.0",
    "sequelize-auto-migrations": "^1.0.3",
    "sequelize-cli": "^6.4.1",
    "url": "^0.11.0",
    "uuid": "^8.3.2",
    "winston": "^3.7.2"
}

It looks like the express-session module (or your own node application code) has inserted invalid JSON into the session table's data field for one of the sessions. Very unlikely to be a problem with this module.