Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SequelizeDatabaseError when trying to run demo server with mysql #4

Open
cesarpachon opened this issue Oct 25, 2020 · 1 comment
Open

Comments

@cesarpachon
Copy link

Hello, I am trying to run demo server with Mysql (ubuntu 20), I configured ltjs-sequelize but when trying to lift the demo server I got the following error:

~/projects/ltijs-demo-server [master]: npm run start

> [email protected] start /home/cesar/projects/ltijs-demo-server
> env DEBUG=provider:* node index.js

  provider:main Attempting to connect to database +0ms
  provider:database Using Sequelize Database Plugin - Cvmcosta +0ms
  provider:database Dialect: mysql +0ms
Error during deployment:  { SequelizeDatabaseError: BLOB/TEXT column 'iss' used in key specification without a key length
    at Query.formatError (/home/cesar/projects/ltijs-demo-server/node_modules/sequelize/lib/dialects/mysql/query.js:239:16)
    at Query.run (/home/cesar/projects/ltijs-demo-server/node_modules/sequelize/lib/dialects/mysql/query.js:54:18)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  name: 'SequelizeDatabaseError',
  parent:
   { Error: BLOB/TEXT column 'iss' used in key specification without a key length
       at Packet.asError (/home/cesar/projects/ltijs-demo-server/node_modules/mysql2/lib/packets/packet.js:712:17)
       at Query.execute (/home/cesar/projects/ltijs-demo-server/node_modules/mysql2/lib/commands/command.js:28:26)
       at Connection.handlePacket (/home/cesar/projects/ltijs-demo-server/node_modules/mysql2/lib/connection.js:425:32)
       at PacketParser.Connection.packetParser.p [as onPacket] (/home/cesar/projects/ltijs-demo-server/node_modules/mysql2/lib/connection.js:75:12)
       at PacketParser.executeStart (/home/cesar/projects/ltijs-demo-server/node_modules/mysql2/lib/packet_parser.js:75:16)
       at Socket.Connection.stream.on.data (/home/cesar/projects/ltijs-demo-server/node_modules/mysql2/lib/connection.js:82:25)
       at Socket.emit (events.js:198:13)
       at addChunk (_stream_readable.js:288:12)
       at readableAddChunk (_stream_readable.js:269:11)
       at Socket.Readable.push (_stream_readable.js:224:10)
       at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
     code: 'ER_BLOB_KEY_WITHOUT_LENGTH',
     errno: 1170,
     sqlState: '42000',
     sqlMessage:
      'BLOB/TEXT column \'iss\' used in key specification without a key length',
     sql:
      'ALTER TABLE `idtokens` ADD INDEX `idtokens_iss_client_id_deployment_id_user` (`iss`, `clientId`, `deploymentId`, `user`)',
     parameters: undefined },
  original:
   { Error: BLOB/TEXT column 'iss' used in key specification without a key length
       at Packet.asError (/home/cesar/projects/ltijs-demo-server/node_modules/mysql2/lib/packets/packet.js:712:17)
       at Query.execute (/home/cesar/projects/ltijs-demo-server/node_modules/mysql2/lib/commands/command.js:28:26)
       at Connection.handlePacket (/home/cesar/projects/ltijs-demo-server/node_modules/mysql2/lib/connection.js:425:32)
       at PacketParser.Connection.packetParser.p [as onPacket] (/home/cesar/projects/ltijs-demo-server/node_modules/mysql2/lib/connection.js:75:12)
       at PacketParser.executeStart (/home/cesar/projects/ltijs-demo-server/node_modules/mysql2/lib/packet_parser.js:75:16)
       at Socket.Connection.stream.on.data (/home/cesar/projects/ltijs-demo-server/node_modules/mysql2/lib/connection.js:82:25)
       at Socket.emit (events.js:198:13)
       at addChunk (_stream_readable.js:288:12)
       at readableAddChunk (_stream_readable.js:269:11)
       at Socket.Readable.push (_stream_readable.js:224:10)
       at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
     code: 'ER_BLOB_KEY_WITHOUT_LENGTH',
     errno: 1170,
     sqlState: '42000',
     sqlMessage:
      'BLOB/TEXT column \'iss\' used in key specification without a key length',
     sql:
      'ALTER TABLE `idtokens` ADD INDEX `idtokens_iss_client_id_deployment_id_user` (`iss`, `clientId`, `deploymentId`, `user`)',
     parameters: undefined },
  sql:
   'ALTER TABLE `idtokens` ADD INDEX `idtokens_iss_client_id_deployment_id_user` (`iss`, `clientId`, `deploymentId`, `user`)',
  parameters: undefined }

Closing server...
Closing connection to the database...
  provider:database Closing connection to database +36ms
  provider:database Closed database connection and removed cronjob +0ms
Shutdown complete.

@cesarpachon
Copy link
Author

status update:
I discovered the error in the ltjs-sequelize/dist/DB.js, all of the types for columns that are going to be used as indexes should be replaced from TEXT to STRING. in some cases I need to use STRING(127) as the default was throwing KEY_TOO_LONG error.
after this fix in a bunch of lines the server finally lifted up..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant