Description
Everytime when i try open Directory/Users in Rocketchat web or desktop applications i get error: Cannot read property ‘replace’ of undefined. There is image with problem:
This problem has been going on for a long time. I updated rocketchat from 3.18 version and mongo 4.0 to rocketchat 4.0.3 and mongo 4.4.10 version but i get such error over and over.
I caught the HTTP request and analyzed it but i but did not find any problems. Logs are clean. Does anyone face such a problem?
Server Setup Information
- Version of Rocket.Chat Server: 4.0.3
- Operating System: Linux
- Deployment Method: docker
- Number of Running Instances: 1
- DB Replicaset Oplog:
- NodeJS Version: v12.22.1
- MongoDB Version: 4.4.10 , WiredTiger
- Proxy: cloudflare
- Firewalls involved: no
Hi @WhiteChemist ! Welcome to our forums.
Can you reproduce this error consistently and at a brand new installation?
We some times have difficult reproducing this kind of errors in order to open up a bug and feed our dev team.
Do you use LDAP? Have you created the users manually?
Thanks!
I think that such problem will not reproduce at a new installation.
Yes, we create users manually.
No, ldap i don’t use.
@dudanogueira Have you some ideas?
Can you get the response from the endpoint?
When you open the Developer Tools, and the network tab (chrome at least) you usually have see the payload to endpoint and the response.
Maybe we have more information on that.
Request: https://chat.mydoain/api/v1/directory?query={“type”:“users”,“text”:"",“workspace”:“local”}&sort={“name”:1}&count=25
Request Method: GET
Status Code: 400
Responce: {“success”:false,“error”:“Cannot read property ‘replace’ of undefined”}
Great.
I forgot to ask that too: at the browser console, can you see any relevant log? Usually in red.
sorry!
TypeError: 'microphone' (value of 'name' member of PermissionDescriptor) is not a valid value for enumeration PermissionName.
e https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:971
f https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:768
_withTemplateInstanceFunc https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:768
f https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:768
constructView https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:768
n https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:768
nonreactive https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:724
_fireCallbacks https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:768
_withCurrentView https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:768
_fireCallbacks https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:768
_createView https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:768
_materializeView https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:768
t https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:768
_materializeDOM https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:768
_materializeDOM https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:768
_materializeView https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:768
nonreactive https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:724
_materializeView https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:768
render https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:768
renderWithData https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:768
l /client/views/room/components/BlazeTemplate.js:1
33a8bf82d6ea9032468f38dbbb63231649d4686d.js:971:476507
[XHR] GET https://domain.com/api/v1/directory?query={%22type%22:%22users%22,%22workspace%22:%22local%22}&sort={%22name%22:1}&count=25
[XHR] GET https://domain.com/api/v1/directory?query={"type":"users","text":"","workspace":"local"}&sort={"name":1}&count=25
Error: Bad Request
originalCallback https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:971
processTwoFactorError https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:971
o https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:971
s https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:30
fireWith https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:30
E https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:30
t https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:30
send https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:30
ajax https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:30
u https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:971
_jqueryCall https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:971
_jqueryCall https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:973
get https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:971
get https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:971
c /client/providers/ServerProvider.js:1
p https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:973
b https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:973
p https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:973
ff https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:568
unstable_runWithPriority https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:586
pc https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:568
cf https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:568
Pe https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:568
it https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:568
Error: Bad Request
originalCallback https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:971
processTwoFactorError https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:971
o https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:971
s https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:30
fireWith https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:30
E https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:30
t https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:30
send https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:30
ajax https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:30
u https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:971
_jqueryCall https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:971
_jqueryCall https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:973
get https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:971
get https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:971
c /client/providers/ServerProvider.js:1
p https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:973
b https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:973
p https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:973
ff https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:568
unstable_runWithPriority https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:586
pc https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:568
cf https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:568
of https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:568
D https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:586
onmessage https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:586
33a8bf82d6ea9032468f38dbbb63231649d4686d.js:973:345368
b https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:973
bindEnvironment https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:1
(Асинхронный: promise callback)
then https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:692
b https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:973
p https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:973
ff https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:568
unstable_runWithPriority https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:586
pc https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:568
cf https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:568
of https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:568
D https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:586
onmessage https://domain.com/33a8bf82d6ea9032468f38dbbb63231649d4686d.js?meteor_js_resource=true:586
I’ve added error log. I thought that in my database exists user with word ‘replace’ in name or surname, but i did not find it.
It’s not that it has a “replace” user or anything.
It’s most certainly a code bug, where in some specific situation, it doesn’t define an object, and tries do replace something on it, and there was no replace function, hence the error on an undefined object.
There is probably something wrong with one of the users. Can you delete users (on a test environment) and see if the problem goes away?
Thanks, i will try it and after write
I dropped table users in mongo, after that created admin user and activated it. However, the error remained all the same.
that’s really odd.
If we cannot reproduce it, it’s hard to fix it.
Do you have any custom role, or custom field?
No, we haven’t any custom role or custom field. I think that problem is in meteor. I found some topics with similar problem. For example: Cannot read property 'replace' of undefined · Issue #839 · arunoda/meteor-up-legacy · GitHub
I think that such problem will not reproduce at a new installation.
yes, when i created latest version rocketchat, there wasn’t such problem