-
Notifications
You must be signed in to change notification settings - Fork 13.5k
users.info endpoint: Cannot read property 'username' of undefined #16491
Copy link
Copy link
Closed
Description
Description:
When attempting to call users.info endpoint using
GET http://rocketchat:4000/api/v1/users.info?username=bob`
X-Auth-Token: mOwTQmt_UpOG8HWH_VQCMYyxvLEy_BTnPo6Wpv3zVW2
X-User-Id: 9dgf7Kend5guGWPdD
Error response (http 400):
{"success":false,"error":"Cannot read property 'username' of undefined"}Steps to reproduce:
- Start rocket chat docker image with mongodb
- Curl the
users.infoendpoint with a non-existing user in theusernamefield
Expected behavior:
A http response with a more normal error message. Something similar to results of calling with a userId instead of a username:
{"success":false,"error":"Failed to get the user data for the userId of \"9dgf7Kend5guGWPdD\"."}Actual behavior:
Looks like an internal server error but also returns http 400:
{"success":false,"error":"Cannot read property 'username' of undefined"}Server Setup Information:
- Version of Rocket.Chat Server: 2.4.1, 2.4.7, 3.0.0-rc.2
- Operating System: Ubuntu 18.04
- Deployment Method: Docker
- Number of Running Instances: 1
- MongoDB Version: 4.0
Client Setup Information
- Desktop App or Browser Version: cURL
- Operating System: Ubuntu 18.04
Relevant logs:
rocketchat_1 | API ➔ debug get users.info threw an error: TypeError: Cannot read property 'username' of undefined
rocketchat_1 | at getFullUserData (app/lib/server/functions/getFullUserData.js:106:58)
rocketchat_1 | at Object.get (app/api/server/v1/users.js:166:6)
rocketchat_1 | at app/api/server/api.js:343:82
rocketchat_1 | at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)
rocketchat_1 | at Object._internalRouteActionHandler [as action] (app/api/server/api.js:343:39)
rocketchat_1 | at Route.share.Route.Route._callEndpoint (packages/nimble_restivus/lib/route.coffee:150:32)
rocketchat_1 | at packages/nimble_restivus/lib/route.coffee:59:33
rocketchat_1 | at packages/simple_json-routes.js:98:9
rocketchat_1 | API ➔ debug Failure {
rocketchat_1 | statusCode: 400,
rocketchat_1 | body: {
rocketchat_1 | success: false,
rocketchat_1 | error: "Cannot read property 'username' of undefined",
rocketchat_1 | stack: undefined
rocketchat_1 | }
rocketchat_1 | }
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels