Open JonathanBergers opened 8 years ago
I tried accessing the app variable using sails.hooks.http.app
var app = sails.hooks.http.app
app.use(require('express-stormpath').init(app, {
apiKey: {
id: api_key_id,
secret: api_key_secret
},
}));
Now i get this error
TypeError: this.route is not a function
at Function.proto.(anonymous function) [as get] (/home/X/Dropbox/X/Workspace/X/node_modules/express/lib/router/index.js:509:22)
at addGetRoute (/home/X/Dropbox/X/Workspace/X/node_modules/express-stormpath/lib/stormpath.js:136:14)
at Client.<anonymous> (/home/X/Dropbox/X/Workspace/X/node_modules/express-stormpath/lib/stormpath.js:154:9)
at emitOne (events.js:95:20)
at Client.emit (events.js:182:7)
at /home/X/Dropbox/X/Workspace/X/node_modules/stormpath/lib/Client.js:65:14
at /home/x/Dropbox/X/Workspace/X/node_modules/stormpath-config/lib/ConfigLoader.js:84:5
at /home/X/Dropbox/X/Workspace/X/node_modules/stormpath-config/node_modules/async/lib/async.js:52:16
at /home/X/Dropbox/X/Workspace/X/node_modules/stormpath-config/node_modules/async/lib/async.js:1209:30
at /home/X/Dropbox/X/Workspace/X/node_modules/stormpath-config/lib/strategy/EnrichIntegrationFromRemoteConfigStrategy.js:240:7
at /home/X/Dropbox/X/Workspace/X/node_modules/stormpath-config/node_modules/async/lib/async.js:52:16
at /home/X/Dropbox/X/Workspace/X/node_modules/stormpath-config/node_modules/async/lib/async.js:1209:30
at /home/X/Dropbox/X/Workspace/X/node_modules/stormpath-config/lib/strategy/EnrichIntegrationFromRemoteConfigStrategy.js:208:9
at /home/X/Dropbox/X/Workspace/X/node_modules/stormpath-config/lib/strategy/EnrichIntegrationFromRemoteConfigStrategy.js:169:9
at Object.wrapGetResourceResponse [as _wrapGetResourceResponse] (/home/X/Dropbox/X/Workspace/X/node_modules/stormpath/lib/ds/DataStore.js:84:12)
at onGetResourceRequestResult (/home/X/XXnode_modules/stormpath/lib/ds/DataStore.js:273:13)
Hi JonathanBergers, I'm not very expert in Express... But I have fixed the same error by upgrading Express 3 to 4. Check the version of Express in your application package.json, probably you are using express version 3.
Hope it will help you.. :)
Hi. I want to configure sails with stormpath. I followed the tutorial for using stormpath with express.
I enable the middleware in the sails http.js like this:
But when i launch the application i get the following error:
TypeError: app.set is not a function at initClient (/home/jonathan/Dropbox/X/Workspace/X/node_modules/express-stormpath/lib/stormpath.js:43:7) at Object.module.exports.init (/home/X/Dropbox/X/Workspace/X/node_modules/express-stormpath/lib/stormpath.js:74:16) at Object.module.exports.http.middleware.storm_path [as handle] (/home/X/Dropbox/X/Workspace/X/config/http.js:32:45) at next (/home/X/.linuxbrew/lib/node_modules/sails/node_modules/express/node_modules/connect/lib/proto.js:174:15) at Object._exposeSailsOnReq [as handle] (/home/X/.linuxbrew/lib/node_modules/sails/lib/hooks/http/initialize.js:169:16) at next (/home/X/.linuxbrew/lib/node_modules/sails/node_modules/express/node_modules/connect/lib/proto.js:174:15) at Object.expressInit [as handle] (/home/X/.linuxbrew/lib/node_modules/sails/node_modules/express/lib/middleware.js:30:5) at next (/home/X/.linuxbrew/lib/node_modules/sails/node_modules/express/node_modules/connect/lib/proto.js:174:15) at Object.query [as handle] (/home/X/.linuxbrew/lib/node_modules/sails/node_modules/express/node_modules/connect/lib/middleware/query.js:43:5) at next (/home/X/.linuxbrew/lib/node_modules/sails/node_modules/express/node_modules/connect/lib/proto.js:174:15) at Function.app.handle (/home/X/.linuxbrew/lib/node_modules/sails/node_modules/express/node_modules/connect/lib/proto.js:182:3) at Server.app (/home/X/.linuxbrew/lib/node_modules/sails/node_modules/express/node_modules/connect/lib/connect.js:67:37) at Server.<anonymous> (/home/X/.linuxbrew/lib/node_modules/sails/node_modules/engine.io/lib/server.js:434:22) at emitTwo (events.js:100:13) at Server.emit (events.js:185:7) at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:537:12)
Cant find a solution for my problem on the internet.. Anyone who can help me ?