I'm currently building a Keystone.js project, and need to use some Express.js middleware libraries with it. Since Keystone.js is built on top of Express.js, this seemed like it would be fairly easy, but I'm running into lots of issues getting things working so far.
Here's what I'm currently trying (this is my best guess as to the correct way to do this):
In my keystone.js
file (the app's main entrypoint), I'm inserting the following code directly before keystone.start()
:
keystone.app.use(stormpath.init(keystone.app, {
...
}));
The important bit here is the keystone.app.use(...);
bit -- I took a look at the Keystone.js source, and it appears that the underlying Express.js application object is exposed as keystone.app
, which is why I'm attempting to use it this way.
Unfortunately, while my Keystone web server starts when running $ node keystone.js
, trying to load any page on my site results in the following exception:
$ node keystone.js
------------------------------------------------
KeystoneJS Started:
keystone is ready on port 3000
------------------------------------------------
TypeError: Object #<Object> has no method 'regenerate'
at doSignin (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/lib/session.js:38:15)
at Promise.<anonymous> (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/lib/session.js:72:5)
at Promise.<anonymous> (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:177:8)
at Promise.EventEmitter.emit (events.js:95:17)
at Promise.emit (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:84:38)
at Promise.fulfill (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:97:20)
at Promise.resolve (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/lib/promise.js:114:23)
at Promise.<anonymous> (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:177:8)
at Promise.EventEmitter.emit (events.js:95:17)
at Promise.emit (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:84:38)
at Promise.fulfill (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:97:20)
at /Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/lib/query.js:1400:13
at model.Document.init (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/lib/document.js:250:11)
at completeOne (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/lib/query.js:1398:10)
at Object.cb (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/lib/query.js:1155:11)
at Object._onImmediate (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mquery/lib/utils.js:137:16)
I've got MongoDB running locally just fine, and if I comment out my code above things work as expected, so I know this is the root cause.
Any help would be appreciated.