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

CLI command bug: 'Feathers generate authentication' produces bad working 'users' service #670

Closed
ganchikov opened this Issue Apr 24, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@ganchikov
Copy link

ganchikov commented Apr 24, 2018

Steps to reproduce

run cli command 'feathers generate authentication' with default service name for users ('users')
add hook for users create action (before hashPassword)

Expected behavior

cli command should produce working users service

Actual behavior

code of users service produced incorrectly - when posting data (create), it is parsed incorrectly and results in an Object with the key equals to JSON data and value equals to '', e.g.:

Object {{"email" : "email@address.com", "password" : "12345"}: ""}

as a workaround i had to use Object.getOwnPropertyNames and use JSON.parse which produces correct object which is then asigned to context.data and retrieved by hook

System configuration

Module versions (especially the part that's not working):
"dependencies": {
"@feathersjs/authentication": "^2.1.5",
"@feathersjs/authentication-jwt": "^2.0.0",
"@feathersjs/authentication-local": "^1.1.3",
"@feathersjs/authentication-oauth2": "^1.0.3",
"@feathersjs/configuration": "^1.0.2",
"@feathersjs/errors": "^3.3.0",
"@feathersjs/express": "^1.2.1",
"@feathersjs/feathers": "^3.1.4",
"@feathersjs/socketio": "^3.2.1",
"app-root-path": "^2.0.1",
"compression": "^1.7.1",
"cors": "^2.8.4",
"feathers-mongoose": "^6.1.0",
"helmet": "^3.12.0",
"mongoose": "^5.0.14",
"morgan": "^1.9.0",
"passport-auth0": "^0.6.1",
"serve-favicon": "^2.5.0",
"winston": "^2.4.1"
},
"devDependencies": {
"eslint": "^4.15.0",
"feathers-memory": "^2.1.1",
"mocha": "^5.0.5",
"request": "^2.83.0",
"request-promise": "^4.2.2",
"shx": "^0.2.2"
}

NodeJS version:
v 8.9.4

Operating System:
Win 7 x64

Browser Version:
n/a

React Native Version:
n/a

Module Loader:
npm 5.6.0

@daffl

This comment has been minimized.

Copy link
Member

daffl commented Apr 27, 2018

I'm not sure I am following the issue and wasn't able to reproduce something that breaks. Can you share a repository that demonstrates the problem?

@ganchikov

This comment has been minimized.

Copy link
Author

ganchikov commented Apr 27, 2018

here is git: https://github.com/ganchikov/feathers-bug
re-tested, it was an issue with specifying header:
this one is working:
curl http://localhost:3030/users/ -H 'Content-Type: application/json' --data-binary '{"email":"sample@sample.com", "password":"12345"}'
this one is not (see extra space between Content-Type and ':' symbol):
curl http://localhost:3030/users/ -H 'Content-Type : application/json' --data-binary '{"email":"sample@sample.com", "password":"12345"}'
it is likely not a bug but lack of my attention, so feel free to close it

@daffl

This comment has been minimized.

Copy link
Member

daffl commented Apr 27, 2018

That's how HTTP headers are specified so I don't think this is a Feathers specific issue (Node's internal HTTP header parser will probably never pick it up). Good to know though, I never noticed that behaviour!

@daffl daffl closed this Apr 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.