You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var s = {
session: session // <~~~ object
};
// snip
coll.create(s, function(err) {
callback(err);
});
The problem is that when the row is retrieved, jugglingdb-mysql returns session as a string, not an object, which I believe is in violation of the jugglingdb contract for the JSON datatype.
For example, this behavior causes connect-jugglingdb to crash my express app. In the snippet below (from connect-jugglingdb/index.js), jugglingdb-mysql returns session.session as a string. The crash-causing exception happens in the callback because it expects an object.
this.collection.findOne({where: {sid: sid}}, function(err, session) {
if (err) return callback(err);
if (!session) return callback();
if (!session.expires || new Date() < session.expires) {
callback(null, session.session); // <~~~ oops... not an object!
} else {
self.destroy(sid, callback);
}
});
The text was updated successfully, but these errors were encountered:
I think for some reason text->JSON and JSON->text used to happen in JDB core, however if that's no longer the case, you could add the appropriate case to fromDatabase and parse into JSON there:
I found this issue while using connect-jugglingdb to manage a session store in my express app.
connect-jugglingdb creates a Session schema with a JSON column named
session
A row is created with
session
set to an object.The problem is that when the row is retrieved, jugglingdb-mysql returns
session
as a string, not an object, which I believe is in violation of the jugglingdb contract for the JSON datatype.For example, this behavior causes connect-jugglingdb to crash my express app. In the snippet below (from connect-jugglingdb/index.js), jugglingdb-mysql returns
session.session
as a string. The crash-causing exception happens in the callback because it expects an object.The text was updated successfully, but these errors were encountered: