This repository was archived by the owner on Mar 22, 2022. It is now read-only.
Description I encountered the following issue while trying to work with multiple feathers instances :
The following configuration throws an error if I try to POST to /auth/local with username and password :
var app = feathers()
.configure(rest())
.configure(hooks())
// .configure(socketio())
.use(bodyParser.json())
.use(bodyParser.urlencoded({ extended: true }))
.configure(authentication({
setUpSuccessRedirect: false,
setUpFailureRedirect: false,
idField: 'id',
userEndpoint: serviceEndpoint + SERVICE_ENDPOINT_USER,
token: {
secret: JWT_SECRET,
tokenEndpoint: serviceEndpoint + SERVICE_ENDPOINT_AUTH_TOKEN,
userEndpoint: serviceEndpoint + SERVICE_ENDPOINT_USER,
jwtOptions: {
expiresIn: JWT_EXPIRES_IN
},
},
local: {
type: 'local',
usernameField: 'username',
userEndpoint: serviceEndpoint + SERVICE_ENDPOINT_USER,
localEndpoint: serviceEndpoint + SERVICE_ENDPOINT_AUTH_LOCAL,
successRedirect: serviceEndpoint + SERVICE_ENDPOINT_AUTH_SUCCESS,
tokenEndpoint: serviceEndpoint + SERVICE_ENDPOINT_AUTH_TOKEN,
jwtOptions: {
expiresIn: JWT_EXPIRES_IN
},
},
localEndpoint: serviceEndpoint + SERVICE_ENDPOINT_AUTH_LOCAL,
tokenEndpoint: serviceEndpoint + SERVICE_ENDPOINT_AUTH_TOKEN
}));
var feathersapp = feathers().use('/api/v1/rest', app);
Error :
TypeError: Cannot read property 'service' of undefined
<br> at Object.checkCredentials (/root/RAF/api/node_modules/feathers-authentication/lib/services/local/index.js:80:15)
<br> at Strategy.authenticate (/root/RAF/api/node_modules/passport-local/lib/strategy.js:90:12)
<br> at attempt (/root/RAF/api/node_modules/passport/lib/middleware/authenticate.js:348:16)
<br> at authenticate (/root/RAF/api/node_modules/passport/lib/middleware/authenticate.js:349:7)
<br> at /root/RAF/api/node_modules/feathers-authentication/lib/services/local/index.js:137:9
<br> at new Promise (/root/RAF/api/node_modules/core-js/modules/es6.promise.js:197:7)
<br> at Object.create (/root/RAF/api/node_modules/feathers-authentication/lib/services/local/index.js:116:14)
<br> at Object.wrapper (/root/RAF/api/node_modules/feathers/lib/mixins/promise.js:30:28)
<br> at Object.<anonymous> (/root/RAF/api/node_modules/uberproto/lib/proto.js:30:17)
<br> at Object.wrapped (/root/RAF/api/node_modules/rubberduck/lib/rubberduck.js:63:19)
<br> at /root/RAF/api/node_modules/feathers-hooks/lib/before.js:53:20
<br> at new Promise (/root/RAF/api/node_modules/core-js/modules/es6.promise.js:197:7)
<br> at /root/RAF/api/node_modules/feathers-hooks/lib/before.js:40:18
<br> at run (/root/RAF/api/node_modules/core-js/modules/es6.promise.js:104:47)
<br> at /root/RAF/api/node_modules/core-js/modules/es6.promise.js:115:28
<br> at flush (/root/RAF/api/node_modules/core-js/modules/$.microtask.js:19:5)
If I uncomment the following line to use socketio it works :
// .configure(socketio())
I think the app variable is not available in services/local/index.js if you don't setup socketio in feathers.
Reactions are currently unavailable
I encountered the following issue while trying to work with multiple feathers instances :
The following configuration throws an error if I try to POST to /auth/local with username and password :
Error :
If I uncomment the following line to use socketio it works :
// .configure(socketio())I think the app variable is not available in
services/local/index.jsif you don't setup socketio in feathers.