ging / fiware-idm

OAuth 2.0-based authentication of users and devices, user profile management, Single Sign-On (SSO) and Identity Federation across multiple administration domains.
https://keyrock-fiware.github.io
MIT License
36 stars 80 forks source link

Keyrock IDM 8.1.0 and 8.0.0 fail to get token - DatabaseError [SequelizeDatabaseError]: Unknown column 'hash' in 'field list' #259

Open tazchalmers opened 2 years ago

tazchalmers commented 2 years ago

I tried upgrading to 8.1.0 but get an error when trying to generate an access token - which I also got when rolling back to 8.0.0:

$ curl -X POST 'http://localhost:3005/oauth2/token' -H 'Accept: application/json' -H 'Authorization: Basic NTli...Yw==' -H 'Content-Type: application/x-www-form-urlencoded' --data "username=user@email.com&password=password&grant_type=password"

"Cannot read property 'includes' of undefined"

The IDM log:

fiware-keyrock-1         | Thu, 11 Nov 2021 09:22:44 GMT idm:oauth_controller  --> token
fiware-keyrock-1         | Thu, 11 Nov 2021 09:22:44 GMT idm:oauth_controller {
fiware-keyrock-1         |   username: 'user@email.com',
fiware-keyrock-1         |   password: 'password',
fiware-keyrock-1         |   grant_type: 'password'
fiware-keyrock-1         | }
fiware-keyrock-1         | Thu, 11 Nov 2021 09:22:44 GMT idm:oauth2-model_oauth_server -------getClient-------
fiware-keyrock-1         | Thu, 11 Nov 2021 09:22:44 GMT idm:oauth2-model_oauth_server -------getIdentity-------
fiware-keyrock-1         | Thu, 11 Nov 2021 09:22:44 GMT idm:oauth2-model_oauth_server 59b...e90
fiware-keyrock-1         | Thu, 11 Nov 2021 09:22:44 GMT idm:oauth2-model_oauth_server -------validateScope-------
fiware-keyrock-1         | Thu, 11 Nov 2021 09:22:44 GMT idm:oauth2-model_oauth_server -------saveToken-------
fiware-keyrock-1         | Thu, 11 Nov 2021 09:22:44 GMT idm:oauth2-model_oauth_server -------storeToken-------
fiware-keyrock-1         | Thu, 11 Nov 2021 09:22:44 GMT idm:oauth2-model_oauth_server saveToken - Err:  DatabaseError [SequelizeDatabaseError]: Unknown column 'hash' in 'field list'
fiware-keyrock-1         |     at Query.formatError (/opt/fiware-idm/node_modules/sequelize/lib/dialects/mysql/query.js:247:16)
fiware-keyrock-1         |     at Query.handler [as onResult] (/opt/fiware-idm/node_modules/sequelize/lib/dialects/mysql/query.js:68:23)
fiware-keyrock-1         |     at Query.execute (/opt/fiware-idm/node_modules/mysql2/lib/commands/command.js:30:14)
fiware-keyrock-1         |     at Connection.handlePacket (/opt/fiware-idm/node_modules/mysql2/lib/connection.js:408:32)
fiware-keyrock-1         |     at PacketParser.onPacket (/opt/fiware-idm/node_modules/mysql2/lib/connection.js:70:12)
fiware-keyrock-1         |     at PacketParser.executeStart (/opt/fiware-idm/node_modules/mysql2/lib/packet_parser.js:75:16)
fiware-keyrock-1         |     at Socket.<anonymous> (/opt/fiware-idm/node_modules/mysql2/lib/connection.js:77:25)
fiware-keyrock-1         |     at Socket.emit (events.js:314:20)
fiware-keyrock-1         |     at addChunk (_stream_readable.js:297:12)
fiware-keyrock-1         |     at readableAddChunk (_stream_readable.js:272:9)
fiware-keyrock-1         |     at Socket.Readable.push (_stream_readable.js:213:10)
fiware-keyrock-1         |     at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
fiware-keyrock-1         |   parent: Error: Unknown column 'hash' in 'field list'
fiware-keyrock-1         |       at Packet.asError (/opt/fiware-idm/node_modules/mysql2/lib/packets/packet.js:708:17)
fiware-keyrock-1         |       at Query.execute (/opt/fiware-idm/node_modules/mysql2/lib/commands/command.js:28:26)
fiware-keyrock-1         |       at Connection.handlePacket (/opt/fiware-idm/node_modules/mysql2/lib/connection.js:408:32)
fiware-keyrock-1         |       at PacketParser.onPacket (/opt/fiware-idm/node_modules/mysql2/lib/connection.js:70:12)
fiware-keyrock-1         |       at PacketParser.executeStart (/opt/fiware-idm/node_modules/mysql2/lib/packet_parser.js:75:16)
fiware-keyrock-1         |       at Socket.<anonymous> (/opt/fiware-idm/node_modules/mysql2/lib/connection.js:77:25)
fiware-keyrock-1         |       at Socket.emit (events.js:314:20)
fiware-keyrock-1         |       at addChunk (_stream_readable.js:297:12)
fiware-keyrock-1         |       at readableAddChunk (_stream_readable.js:272:9)
fiware-keyrock-1         |       at Socket.Readable.push (_stream_readable.js:213:10)
fiware-keyrock-1         |       at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
fiware-keyrock-1         |     code: 'ER_BAD_FIELD_ERROR',
fiware-keyrock-1         |     errno: 1054,
fiware-keyrock-1         |     sqlState: '42S22',
fiware-keyrock-1         |     sqlMessage: "Unknown column 'hash' in 'field list'",
fiware-keyrock-1         |     sql: "INSERT INTO `oauth_access_token` (`hash`,`access_token`,`expires`,`scope`,`valid`,`oauth_client_id`,`user_id`,`iot_id`,`refresh_token`,`authorization_code`) VALUES ('efb...1f2','986...b89','2021-11-11 10:22:44','bearer',true,'59b...e90','174...0bf',NULL,'b88...4a4',NULL);"
fiware-keyrock-1         |   },
fiware-keyrock-1         |   original: Error: Unknown column 'hash' in 'field list'
fiware-keyrock-1         |       at Packet.asError (/opt/fiware-idm/node_modules/mysql2/lib/packets/packet.js:708:17)
fiware-keyrock-1         |       at Query.execute (/opt/fiware-idm/node_modules/mysql2/lib/commands/command.js:28:26)
fiware-keyrock-1         |       at Connection.handlePacket (/opt/fiware-idm/node_modules/mysql2/lib/connection.js:408:32)
fiware-keyrock-1         |       at PacketParser.onPacket (/opt/fiware-idm/node_modules/mysql2/lib/connection.js:70:12)
fiware-keyrock-1         |       at PacketParser.executeStart (/opt/fiware-idm/node_modules/mysql2/lib/packet_parser.js:75:16)
fiware-keyrock-1         |       at Socket.<anonymous> (/opt/fiware-idm/node_modules/mysql2/lib/connection.js:77:25)
fiware-keyrock-1         |       at Socket.emit (events.js:314:20)
fiware-keyrock-1         |       at addChunk (_stream_readable.js:297:12)
fiware-keyrock-1         |       at readableAddChunk (_stream_readable.js:272:9)
fiware-keyrock-1         |       at Socket.Readable.push (_stream_readable.js:213:10)
fiware-keyrock-1         |       at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
fiware-keyrock-1         |     code: 'ER_BAD_FIELD_ERROR',
fiware-keyrock-1         |     errno: 1054,
fiware-keyrock-1         |     sqlState: '42S22',
fiware-keyrock-1         |     sqlMessage: "Unknown column 'hash' in 'field list'",
fiware-keyrock-1         |     sql: "INSERT INTO `oauth_access_token` (`hash`,`access_token`,`expires`,`scope`,`valid`,`oauth_client_id`,`user_id`,`iot_id`,`refresh_token`,`authorization_code`) VALUES ('efb...1f2','986...b89','2021-11-11 10:22:44','bearer',true,'59b...e90','174...0bf',NULL,'b88...4a4',NULL);"
fiware-keyrock-1         |   },
fiware-keyrock-1         |   sql: "INSERT INTO `oauth_access_token` (`hash`,`access_token`,`expires`,`scope`,`valid`,`oauth_client_id`,`user_id`,`iot_id`,`refresh_token`,`authorization_code`) VALUES ('efb...1f2','986...b89','2021-11-11 10:22:44','bearer',true,'59b...e90','174...0bf',NULL,'b88...4a4',NULL);"
fiware-keyrock-1         | }
fiware-keyrock-1         | Thu, 11 Nov 2021 09:22:44 GMT idm:oauth_controller Error  server_error: Cannot read property 'includes' of undefined
fiware-keyrock-1         |     at new ServerError (/opt/fiware-idm/node_modules/oauth2-server/lib/errors/server-error.js:25:14)
fiware-keyrock-1         |     at TokenHandler.<anonymous> (/opt/fiware-idm/node_modules/oauth2-server/lib/handlers/token-handler.js:107:13)
fiware-keyrock-1         |     at TokenHandler.tryCatcher (/opt/fiware-idm/node_modules/oauth2-server/node_modules/bluebird/js/release/util.js:16:23)
fiware-keyrock-1         |     at Promise._settlePromiseFromHandler (/opt/fiware-idm/node_modules/oauth2-server/node_modules/bluebird/js/release/promise.js:512:31)
fiware-keyrock-1         |     at Promise._settlePromise (/opt/fiware-idm/node_modules/oauth2-server/node_modules/bluebird/js/release/promise.js:569:18)
fiware-keyrock-1         |     at Promise._settlePromise0 (/opt/fiware-idm/node_modules/oauth2-server/node_modules/bluebird/js/release/promise.js:614:10)
fiware-keyrock-1         |     at Promise._settlePromises (/opt/fiware-idm/node_modules/oauth2-server/node_modules/bluebird/js/release/promise.js:689:18)
fiware-keyrock-1         |     at Async._drainQueue (/opt/fiware-idm/node_modules/oauth2-server/node_modules/bluebird/js/release/async.js:133:16)
fiware-keyrock-1         |     at Async._drainQueues (/opt/fiware-idm/node_modules/oauth2-server/node_modules/bluebird/js/release/async.js:143:10)
fiware-keyrock-1         |     at Immediate.Async.drainQueues [as _onImmediate] (/opt/fiware-idm/node_modules/oauth2-server/node_modules/bluebird/js/release/async.js:17:14)
fiware-keyrock-1         |     at processImmediate (internal/timers.js:461:21) {
fiware-keyrock-1         |   statusCode: 503,
fiware-keyrock-1         |   status: 503,
fiware-keyrock-1         |   code: 503,
fiware-keyrock-1         |   inner: TypeError: Cannot read property 'includes' of undefined
fiware-keyrock-1         |       at new TokenModel (/opt/fiware-idm/node_modules/oauth2-server/lib/models/token-model.js:18:18)
fiware-keyrock-1         |       at TokenHandler.<anonymous> (/opt/fiware-idm/node_modules/oauth2-server/lib/handlers/token-handler.js:102:19)
fiware-keyrock-1         |       at PassThroughHandlerContext.finallyHandler (/opt/fiware-idm/node_modules/oauth2-server/node_modules/bluebird/js/release/finally.js:57:23)
fiware-keyrock-1         |       at PassThroughHandlerContext.tryCatcher (/opt/fiware-idm/node_modules/oauth2-server/node_modules/bluebird/js/release/util.js:16:23)
fiware-keyrock-1         |       at Promise._settlePromiseFromHandler (/opt/fiware-idm/node_modules/oauth2-server/node_modules/bluebird/js/release/promise.js:512:31)
fiware-keyrock-1         |       at Promise._settlePromise (/opt/fiware-idm/node_modules/oauth2-server/node_modules/bluebird/js/release/promise.js:569:18)
fiware-keyrock-1         |       at Promise._settlePromise0 (/opt/fiware-idm/node_modules/oauth2-server/node_modules/bluebird/js/release/promise.js:614:10)
fiware-keyrock-1         |       at Promise._settlePromises (/opt/fiware-idm/node_modules/oauth2-server/node_modules/bluebird/js/release/promise.js:693:18)
fiware-keyrock-1         |       at Async._drainQueue (/opt/fiware-idm/node_modules/oauth2-server/node_modules/bluebird/js/release/async.js:133:16)
fiware-keyrock-1         |       at Async._drainQueues (/opt/fiware-idm/node_modules/oauth2-server/node_modules/bluebird/js/release/async.js:143:10)
fiware-keyrock-1         |       at Immediate.Async.drainQueues [as _onImmediate] (/opt/fiware-idm/node_modules/oauth2-server/node_modules/bluebird/js/release/async.js:17:14)
fiware-keyrock-1         |       at processImmediate (internal/timers.js:461:21)
fiware-keyrock-1         | }