GithubHelp home page GithubHelp logo

Comments (5)

RohanAntony avatar RohanAntony commented on May 23, 2024

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.

mweibel avatar mweibel commented on May 23, 2024

from connect-session-sequelize.

MarlonS91 avatar MarlonS91 commented on May 23, 2024

I am having the same problem as outlined by @RohanAntony.

from connect-session-sequelize.

MarlonS91 avatar MarlonS91 commented on May 23, 2024

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.

mweibel avatar mweibel commented on May 23, 2024

I repeat myself: I welcome PRs for updating the docs.

from connect-session-sequelize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.