RocketChat / RocketChat/Rocket.Chat
"Sign in with Apple" could not updateOwnBasicInfo
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
When enable the "Sign in with Apple", the server returned when calling API api/v1/users.updateOwnBasicInfo, the server returned:
Cannot read property '0' of undefined
Steps to reproduce:
- Enable "Sign in with Apple" in the server
- Mobile tapped on "Sign in with Apple" on the device
- After authorized, mobile app show "SetUsernameView"
- Choose any username and click register
Expected behavior:
Can register an account after authorized with Apple service
Actual behavior:

Server Setup Information:
- Version of Rocket.Chat Server: 4.5.0
- Operating System: Ubuntu
- Deployment Method:
- Number of Running Instances: 2
- DB Replicaset Oplog:
- NodeJS Version:
- MongoDB Version:
Client Setup Information
- Desktop App or Browser Version: 4.25.0
- Operating System: iOS
Server log
{
{
"level": 35,
"time": "2022-03-15T15:35:18.972Z",
"pid": 827239,
"hostname": "rocketchat-sgp-4vcpu-8gb-02",
"name": "API",
"method": "POST",
"url": "/api/v1/users.updateOwnBasicInfo",
"userId": "",
"userAgent": "RC Mobile; ios 15.3.1; v4.25.0 (27)",
"length": "36",
"host": "",
"remoteIP": "",
"err": {
"type": "TypeError",
"message": "Cannot read property '0' of undefined",
"stack": "TypeError: Cannot read property '0' of undefined\n at validateUserEditing (app/lib/server/functions/saveUser.js:210:3)\n at MethodInvocation.saveUserProfile (server/methods/saveUserProfile.js:27:2)\n at MethodInvocation.saveUserProfile (server/methods/saveUserProfile.js:137:26)\n at MethodInvocation.methodsMap.<computed> (app/lib/server/lib/debug.js:74:34)\n at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1885:12)\n at packages/ddp-server/livedata_server.js:1803:15\n at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1257:12)\n at packages/ddp-server/livedata_server.js:1801:36\n at new Promise (<anonymous>)\n at Server.applyAsync (packages/ddp-server/livedata_server.js:1800:12)\n at Server.apply (packages/ddp-server/livedata_server.js:1739:26)\n at Server.call (packages/ddp-server/livedata_server.js:1721:17)\n at DDPCommon.MethodInvocation.<anonymous> (app/api/server/v1/users.js:654:47)\n at packages/dispatch_run-as-user.js:211:14\n at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1257:12)\n at Object.Meteor.runAsUser (packages/dispatch_run-as-user.js:210:33)\n at Object.post (app/api/server/v1/users.js:654:11)\n at app/api/server/api.js:425:96\n at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1257:12)\n at Object._internalRouteActionHandler [as action] (app/api/server/api.js:425:39)\n at Route._callEndpoint (packages/rocketchat_restivus/lib/route.coffee:150:32)\n at packages/rocketchat_restivus/lib/route.coffee:59:33\n => awaited here:\n at Promise.await (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:60:12)\n at Server.apply (packages/ddp-server/livedata_server.js:1752:22)\n at Server.call (packages/ddp-server/livedata_server.js:1721:17)\n at DDPCommon.MethodInvocation.<anonymous> (app/api/server/v1/users.js:654:47)\n at packages/dispatch_run-as-user.js:211:14\n at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1257:12)\n at Object.Meteor.runAsUser (packages/dispatch_run-as-user.js:210:33)\n at Object.post (app/api/server/v1/users.js:654:11)\n at app/api/server/api.js:425:96\n at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1257:12)\n at Object._internalRouteActionHandler [as action] (app/api/server/api.js:425:39)\n at Route._callEndpoint (packages/rocketchat_restivus/lib/route.coffee:150:32)\n at packages/rocketchat_restivus/lib/route.coffee:59:33\n at packages/simple_json-routes.js:100:9"
},
"status": 400,
"responseTime": 13,
"msg": "Cannot read property '0' of undefined"
}
}
Look further, when login second time, Apple return null in the email & fullName
https://stackoverflow.com/questions/66131443/sign-in-with-apple-in-react-native-returning-null
{
"identityToken": "eyuaC-gCw1SQRQlfupTXclfzf64ItdLvO5RyJJSZnvvEnnH916LqEPC0SuFxAQzkzfzC7qPaBO4_2rvJl6il2eocQ8L28HFCierw",
"realUserStatus": 1,
"authorizationCode": "c8af181d8607d0.0.rrwrx.wpaY3uKsz8eDAQ",
"fullName": {
"namePrefix": null,
"givenName": null,
"nameSuffix": null,
"nickname": null,
"familyName": null,
"middleName": null
},
"email": null,
"state": null,
"user": "001617.6ab8cacf88273df8bf.0306"
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at validateUserEditing in app/lib/server/functions/saveUser.js around line 210, then trace saveUserProfile in server/methods/saveUserProfile.js and the users.updateOwnBasicInfo endpoint in app/api/server/v1/users.js. Reproduce the Apple sign-in flow with missing email and fullName values; done means the account can register without the Cannot read property '0' of undefined error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, authentication, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100