Comments (5)
So, it turns out that if you have NO_BACKSLASH_ESCAPE turned on, this errors shows up. The MySQL driver automatically escapes strings, so all the double quotes in the JSON string are being escaped. It wasn't noticed before because MySQL was ignoring the backslashes, but I think the auto-escaping of JSON is more the issue. I've suggested to the maintainers of the MySQL driver to try to detect if the string is JSON first before escaping.
from express-mysql-session.
Alternatively, updating the query to concat the JSON string directly in would be another way around the problem.
from express-mysql-session.
I don't think the issue you're experiencing should be handled within this module. It uses JSON.stringify()
to create a string from the session data before inserting it into the database. This module uses node-mysql module internally for creating MySQL connections. All the options you pass to the new SessionStore(options)
constructor are also passed thru to the node-mysql module. So if you need to pass options to it for how to handle string data when inserting it into the database, you can do that.
Hope this helps!
from express-mysql-session.
Yeah, the node-mysql people are going to put the NO_BACKSLASH_ESCAPE as a known issue :)
from express-mysql-session.
Great. Glad things got sorted out for you :)
from express-mysql-session.
Related Issues (20)
- Adding autoincrement column HOT 3
- Please update "debug" dependency HOT 2
- Blacklist items in req.session to not be stored in database. HOT 2
- Delete record from table when user log out? HOT 3
- Update underscore package dependency
- Upgrade to mysql2 package HOT 7
- Incorrect string value HOT 4
- Promisse problem when utilizing mysql2. HOT 4
- PROTOCOL_ENQUEUE_AFTER_FATAL_ERROR with express-mysql-session HOT 4
- sessions table empty (using mysql2) HOT 2
- Unexpected end of JSON input HOT 1
- resave session on each request even if resave is set to false HOT 2
- Error when using MariaDB pool HOT 6
- Sessions Expireds don´t drop of BD mysql HOT 1
- When using mysql2 changing the session is asynchronous, it should behave the same way with mysql. So you will have to await the promise HOT 1
- Unable to connect to mysql using ssl HOT 4
- Inconsistent behavior when destroying a session HOT 1
- Cannot create a session store along with mysql2 HOT 1
- query error HOT 4
- Cannot specify database when using an existing connection pool HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from express-mysql-session.