homebase icon indicating copy to clipboard operation
homebase copied to clipboard

TypeError: Cannot read property 'username' of undefined

Open decentral1se opened this issue 5 years ago • 3 comments

When I run curl -X POST -d '{"username": "foo", "password": "bar"}' https://myhomebase.foo/v1/accounts/login and with the following .homebase.yml configuration:

webapi:
  domain: myhomebase.foo
  username: foo
  password: bar

I keep receiving a HTTP 500 and seeing TypeError: Cannot read property 'username' of undefined.

I'm on homebase 2.0.8.

decentral1se avatar Mar 19 '20 13:03 decentral1se

Seems like the relevant check is:

https://github.com/beakerbrowser/homebase/blob/d872a66737f0874808f6e174419c98b1dc01ebc0/lib/webapi.js#L50

Something wrong with my request format? Seems like req.body.username blows up.

decentral1se avatar Mar 19 '20 13:03 decentral1se

Code should probably check if req.body is a non-null object so that it gives a better error message. Not sure why your request is failing, maybe the content-type header is wrong?

pfrazee avatar Mar 23 '20 15:03 pfrazee

Aha, I see, I'll try with the correct headers.

I'll leave this open to track better error messages.

decentral1se avatar Mar 24 '20 18:03 decentral1se