Comments (5)
PS: I tried using SequelizeStore and it worked. I think you should abstract the definition of Table to something like below.
new SequelizeStore({
additionalFields: {
userId: Sequelize.STRING,
},
extendDefaultFields: function(defaults, newData){
defaults['userId']: newData.userId
}
})
from connect-session-sequelize.
from connect-session-sequelize.
I am having the same problem as outlined by @RohanAntony.
from connect-session-sequelize.
I also received an error ...
// as specified by doc
// ref: https://github.com/mweibel/connect-session-sequelize#add-custom-fields-as-a-column
var Session = sequelize.define("Session", {
sid: {
type: Sequelize.STRING,
primaryKey: true,
},
userId: Sequelize.STRING,
expires: Sequelize.DATE,
data: Sequelize.STRING(50000), // throws SequelizeDatabaseError
});
function extendDefaultFields(defaults, session) {
return {
data: defaults.data,
expires: defaults.expires,
userId: session.userId,
};
}
var store = new SessionStore({
db: sequelize,
table: "Session",
extendDefaultFields: extendDefaultFields,
});
Unhandled rejection SequelizeDatabaseError: Column length too big for column 'data' (max = 21845); use BLOB or TEXT instead
at Query.formatError (/home/sunami/Projects/plugged-backend/node_modules/sequelize/lib/dialects/mysql/query.js:244:16)
at Query.handler [as onResult] (/home/sunami/Projects/plugged-backend/node_modules/sequelize/lib/dialects/mysql/query.js:51:23)
at Query.execute (/home/sunami/Projects/plugged-backend/node_modules/mysql2/lib/commands/command.js:30:14)
at Connection.handlePacket (/home/sunami/Projects/plugged-backend/node_modules/mysql2/lib/connection.js:417:32)
at PacketParser.onPacket (/home/sunami/Projects/plugged-backend/node_modules/mysql2/lib/connection.js:75:12)
at PacketParser.executeStart (/home/sunami/Projects/plugged-backend/node_modules/mysql2/lib/packet_parser.js:75:16)
at Socket.<anonymous> (/home/sunami/Projects/plugged-backend/node_modules/mysql2/lib/connection.js:82:25)
at Socket.emit (events.js:314:20)
at Socket.EventEmitter.emit (domain.js:486:12)
at addChunk (_stream_readable.js:304:12)
at readableAddChunk (_stream_readable.js:280:9)
at Socket.Readable.push (_stream_readable.js:219:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
from connect-session-sequelize.
I repeat myself: I welcome PRs for updating the docs.
from connect-session-sequelize.
Related Issues (20)
- Cant use sessions with custom session model HOT 1
- Sequelize v6 beta: bluebird removed so .spread does not work HOT 4
- Sequelize v6.1.0 - this.sessionModel.findOne(...).then(...).asCallback is not a function Error HOT 2
- "UnhandledPromiseRejectionWarning: SequelizeConnectionRefusedError: connect ECONNREFUSED" error unhandled correctly HOT 7
- Point the SessionStore to the required database schema HOT 1
- Duplicate database queries? HOT 2
- Version 7.0.2 did not publish TypeScript definition file HOT 1
- [Question] store.sync() function needed if I create the table myself? HOT 4
- Property 'Store' does not exist on type - typescript support? HOT 1
- Typescript error: Non-abstract class 'SequelizeStore' does not implement inherited abstract member 'destroy' from class 'Store'. HOT 3
- Warning: a promise was created in a handler but was not returned from it HOT 2
- extendDefaultFields doesn't add the session field HOT 1
- Missing the destroy function
- SyntaxError: Unexpected token u in JSON at position 0 HOT 3
- Custom fields never get saved to the database HOT 1
- SyntaxError: Unexpected token o in JSON at position 1 HOT 1
- Session not saving in database HOT 1
- Default options in code inconsistent with documentation HOT 1
- Error at Query.run > Inserting session data into database 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 connect-session-sequelize.