Open cuongnn-smartosc opened 2 years ago
Hi, Can I have a try on this issue?
I have seem this message in another Issue (already with a PR/fix) on similar context (saving user info). Please, check if those are related: https://github.com/RocketChat/Rocket.Chat/issues/24703
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:
Expected behavior:
Can register an account after authorized with Apple service
Actual behavior:
Server Setup Information:
Client Setup Information
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" }