RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.35k stars 10.48k forks source link

ENOENT on setting new avatar #29382

Closed Ziktorin closed 1 year ago

Ziktorin commented 1 year ago

Description:

When setting new profile avatar server returns ENOENT: no such file or directory error

Steps to reproduce:

  1. Go to your profile
  2. Select "Upload" under Profile Picture
  3. Upload desired image

Expected behavior:

New avatar is set

Actual behavior:

New avatar is not set, and ENOENT error is displayed

Server Setup Information:

Client Setup Information

Additional context

It seems to be the case that something in our setup is the cause, becasue we could not reproduce it with clean db. Whlie trying to figure out, what could be the case, we checked rocketchat_avatars collection for any kind of strange documents. While testing it out, we noticed, that filename that is referenced in ENOENT error is actually not in our uploads directory (we are using FileSystem storage). But there was a document in rocketchat_avatars that had an _id, of that same file in ENOENT error. After deleting this document, it was possible to upload a new avatar, but if we tried to upload avatar again after that, the ENOENT error would still occur with filename that is referenced in new _id field of that newly created document. It is something in our setup it seems, but we can't really figure out what it is.

Relevant logs:

users.setAvatar response in DevTools:

error: 
"ENOENT: no such file or directory, stat '/app/uploads/6471d00c5e94959c0f8b5ec5'"
success: 
false

the same log from server:

{"level":35,"time":"2023-05-27T11:00:04.804Z","pid":1966,"hostname":"maxdev","name":"Meteor","method":"saveUserProfile","userId":"sDb9zwXrujSt3DJif","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Rocket.Chat/3.9.3 Chrome/108.0.5359.215 Electron/22.3.5 Safari/537.36","referer":"https://chat1.qoollo.com/account/profile","remoteIP":"10.8.0.74","instanceId":"f3eba437-8864-4441-b454-24adb46f7a1c"} 
{"level":35,"time":"2023-05-27T11:00:04.816Z","pid":1966,"hostname":"maxdev","name":"Meteor","method":"setUserStatus","userId":"sDb9zwXrujSt3DJif","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Rocket.Chat/3.9.3 Chrome/108.0.5359.215 Electron/22.3.5 Safari/537.36","referer":"https://chat1.qoollo.com/account/profile","remoteIP":"10.8.0.74","instanceId":"f3eba437-8864-4441-b454-24adb46f7a1c"} 
{"level":35,"time":"2023-05-27T11:00:04.821Z","pid":1966,"hostname":"maxdev","name":"Meteor","method":"setUserStatus","userId":"sDb9zwXrujSt3DJif","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Rocket.Chat/3.9.3 Chrome/108.0.5359.215 Electron/22.3.5 Safari/537.36","referer":"https://chat1.qoollo.com/account/profile","remoteIP":"10.8.0.74","instanceId":"f3eba437-8864-4441-b454-24adb46f7a1c"} 
{"level":35,"time":"2023-05-27T11:00:04.822Z","pid":1966,"hostname":"maxdev","name":"Meteor","method":"UserPresence:setDefaultStatus","userId":"sDb9zwXrujSt3DJif","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Rocket.Chat/3.9.3 Chrome/108.0.5359.215 Electron/22.3.5 Safari/537.36","referer":"https://chat1.qoollo.com/account/profile","remoteIP":"10.8.0.74","instanceId":"f3eba437-8864-4441-b454-24adb46f7a1c"} 
{"level":35,"time":"2023-05-27T11:00:04.850Z","pid":1966,"hostname":"maxdev","name":"API","method":"POST","url":"/api/v1/method.call/saveUserProfile","userId":"sDb9zwXrujSt3DJif","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Rocket.Chat/3.9.3 Chrome/108.0.5359.215 Electron/22.3.5 Safari/537.36","length":"174","host":"chat1.qoollo.com","referer":"https://chat1.qoollo.com/account/profile","remoteIP":"10.8.0.74","status":200,"responseTime":48} 
{"level":35,"time":"2023-05-27T11:00:05.234Z","pid":1966,"hostname":"maxdev","name":"Meteor","method":"getAvatarSuggestion","userId":"sDb9zwXrujSt3DJif","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Rocket.Chat/3.9.3 Chrome/108.0.5359.215 Electron/22.3.5 Safari/537.36","referer":"https://chat1.qoollo.com/account/profile","remoteIP":"10.8.0.74","instanceId":"f3eba437-8864-4441-b454-24adb46f7a1c"} 
{"level":40,"time":"2023-05-27T11:00:05.235Z","pid":1966,"hostname":"maxdev","name":"DeprecationWarning","section":"METHOD","msg":"getAvatarSuggestion will be deprecated in future versions of Rocket.Chat"} 
{"level":35,"time":"2023-05-27T11:00:05.329Z","pid":1966,"hostname":"maxdev","name":"API","method":"GET","url":"/api/v1/users.getAvatarSuggestion","userId":"sDb9zwXrujSt3DJif","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Rocket.Chat/3.9.3 Chrome/108.0.5359.215 Electron/22.3.5 Safari/537.36","host":"chat1.qoollo.com","referer":"https://chat1.qoollo.com/account/profile","remoteIP":"10.8.0.74","status":200,"responseTime":96} 
{"level":35,"time":"2023-05-27T11:00:05.501Z","pid":1966,"hostname":"maxdev","name":"API","method":"POST","url":"/api/v1/users.setAvatar","userId":"sDb9zwXrujSt3DJif","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Rocket.Chat/3.9.3 Chrome/108.0.5359.215 Electron/22.3.5 Safari/537.36","length":"143763","host":"chat1.qoollo.com","referer":"https://chat1.qoollo.com/account/profile","remoteIP":"10.8.0.74","err":{"type":"Error","message":"ENOENT: no such file or directory, stat '/app/uploads/6471dbeda8f5ef1a5ca8aca7'","stack":"Error: ENOENT: no such file or directory, stat '/app/uploads/6471dbeda8f5ef1a5ca8aca7'<br> => awaited here:<br>    at Function.Promise.await (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)<br>    at server/ufs/ufs-local.ts:72:20<br>    at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40<br> => awaited here:<br>    at Function.Promise.await (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)<br>    at app/file-upload/server/lib/FileUpload.ts:677:4<br>    at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40<br> => awaited here:<br>    at Function.Promise.await (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)<br>    at app/lib/server/functions/setUserAvatar.ts:105:15<br>    at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40<br> => awaited here:<br>    at Function.Promise.await (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)<br>    at app/api/server/v1/users.ts:250:4<br>    at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40<br> => awaited here:<br>    at Function.Promise.await (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)<br>    at app/api/server/api.ts:633:9<br>    at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40","errno":-2,"code":"ENOENT","syscall":"stat","path":"/app/uploads/6471dbeda8f5ef1a5ca8aca7"},"status":400,"responseTime":24,"msg":"ENOENT: no such file or directory, stat '/app/uploads/6471dbeda8f5ef1a5ca8aca7'"} 
Rahulcheerio commented 1 year ago

Can I work on this issue?

Gummikavalier commented 1 year ago

We are having the same issue. Likely to be related to this incoming fix https://github.com/RocketChat/Rocket.Chat/pull/29313

Ziktorin commented 1 year ago

Seems to be fixed in 6.2.4 release