RocketChat / Rocket.Chat

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

Backend storage problem(Drag to RocketChat Conversation or Copy&Paste Upload doesn't work) #13501

Open EdwardWu7 opened 5 years ago

EdwardWu7 commented 5 years ago

Description:

Can not use copy and paste for screenshots

Steps to reproduce:

  1. Go to a session
  2. Just copy a pic or do a screenshot
  3. The paste it, and went internal server error

Or just drag a file to the conversion and click upload, it does not work, internal server error

Expected behavior:

work as normal

Actual behavior:

Can not paste it

image

Server Setup Information:

Additional context

We are using WebDAV as the backend, but from the log below, seems it tried to use GridFS.

Relevant logs:

Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: Error: FileNotFound: no file with id a5izkWYcBsmzmsHwd found Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/gridfs-stream/index.js:188:25 Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at result (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/utils.js:414:17) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at executeCallback (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/utils.js:406:9) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at deleteCallback (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/operations/collection_ops.js:329:17) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at removeDocuments (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/operations/collection_ops.js:344:54) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at handleCallback (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/utils.js:128:55) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at coll.s.topology.remove (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/operations/collection_ops.js:1168:5) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at handler (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/topologies/replset.js:1195:22) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:532:18 Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at _combinedTickCallback (internal/process/next_tick.js:131:7) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at process._tickDomainCallback (internal/process/next_tick.js:218:9) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: Exception while invoking method 'ufsComplete' TypeError: sharp is not a function Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at WebdavStore.uploadsOnValidate [as onValidate] (packages/rocketchat:file-upload/server/lib/FileUpload.js:160:13) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at WebdavStore.validate (packages/jalik:ufs/ufs-store.js:597:18) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at MethodInvocation.ufsComplete (packages/jalik:ufs/ufs-methods.js:79:23) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at MethodInvocation.methodMap.(anonymous function) (packages/rocketchat_monitoring.js:2731:30) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1767:12) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at DDP._CurrentMethodInvocation.withValue (packages/ddp-server/livedata_server.js:719:19) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1304:12) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at DDPServer._CurrentWriteFence.withValue (packages/ddp-server/livedata_server.js:717:46) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1304:12) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at Promise (packages/ddp-server/livedata_server.js:715:46) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at new Promise () Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at Session.method (packages/ddp-server/livedata_server.js:689:23) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at packages/ddp-server/livedata_server.js:559:43 Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: (node:2297) UnhandledPromiseRejectionWarning: Error: Request failed with status code 404 Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at createError (/opt/Rocket.Chat/programs/server/npm/node_modules/axios/lib/core/createError.js:16:15) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at settle (/opt/Rocket.Chat/programs/server/npm/node_modules/axios/lib/core/settle.js:18:12) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at IncomingMessage.handleStreamEnd (/opt/Rocket.Chat/programs/server/npm/node_modules/axios/lib/adapters/http.js:201:11) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at emitNone (events.js:111:20) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at IncomingMessage.emit (events.js:208:7) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at endReadableNT (_stream_readable.js:1064:12) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at _combinedTickCallback (internal/process/next_tick.js:138:11) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at process._tickDomainCallback (internal/process/next_tick.js:218:9) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: (node:2297) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 40) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: (node:2297) UnhandledPromiseRejectionWarning: Error: Request failed with status code 404 Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at createError (/opt/Rocket.Chat/programs/server/npm/node_modules/axios/lib/core/createError.js:16:15) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at settle (/opt/Rocket.Chat/programs/server/npm/node_modules/axios/lib/core/settle.js:18:12) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at IncomingMessage.handleStreamEnd (/opt/Rocket.Chat/programs/server/npm/node_modules/axios/lib/adapters/http.js:201:11) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at emitNone (events.js:111:20) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at IncomingMessage.emit (events.js:208:7) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at endReadableNT (_stream_readable.js:1064:12) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at _combinedTickCallback (internal/process/next_tick.js:138:11) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at process._tickDomainCallback (internal/process/next_tick.js:218:9) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: (node:2297) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 42) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: (node:2297) UnhandledPromiseRejectionWarning: Error: Request failed with status code 404 Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at createError (/opt/Rocket.Chat/programs/server/npm/node_modules/axios/lib/core/createError.js:16:15) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at settle (/opt/Rocket.Chat/programs/server/npm/node_modules/axios/lib/core/settle.js:18:12) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at IncomingMessage.handleStreamEnd (/opt/Rocket.Chat/programs/server/npm/node_modules/axios/lib/adapters/http.js:201:11) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at emitNone (events.js:111:20) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at IncomingMessage.emit (events.js:208:7) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at endReadableNT (_stream_readable.js:1064:12) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at _combinedTickCallback (internal/process/next_tick.js:138:11) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at process._tickDomainCallback (internal/process/next_tick.js:218:9) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: (node:2297) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 44) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: (node:2297) UnhandledPromiseRejectionWarning: Error: Request failed with status code 404 Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at createError (/opt/Rocket.Chat/programs/server/npm/node_modules/axios/lib/core/createError.js:16:15) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at settle (/opt/Rocket.Chat/programs/server/npm/node_modules/axios/lib/core/settle.js:18:12) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at IncomingMessage.handleStreamEnd (/opt/Rocket.Chat/programs/server/npm/node_modules/axios/lib/adapters/http.js:201:11) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at emitNone (events.js:111:20) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at IncomingMessage.emit (events.js:208:7) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at endReadableNT (_stream_readable.js:1064:12) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at _combinedTickCallback (internal/process/next_tick.js:138:11) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: at process._tickDomainCallback (internal/process/next_tick.js:218:9) Feb 17 01:59:28 cnsz02vl00735 RocketChat[2297]: (node:2297) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 46) Feb 17 02:01:14 cnsz02vl00735 RocketChat[2297]: (node:2297) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getRedirectURL' of undefined Feb 17 02:01:14 cnsz02vl00735 RocketChat[2297]: at FileUploadClass.get (packages/rocketchat:file-upload/server/config/AmazonS3.js:10:29) Feb 17 02:01:14 cnsz02vl00735 RocketChat[2297]: at Object.get (packages/rocketchat:file-upload/server/lib/FileUpload.js:268:17) Feb 17 02:01:14 cnsz02vl00735 RocketChat[2297]: at packages/rocketchat:file-upload/server/lib/requests.js:20:22 Feb 17 02:01:14 cnsz02vl00735 RocketChat[2297]: at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40 Feb 17 02:01:14 cnsz02vl00735 RocketChat[2297]: (node:2297) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 47)

EdwardWu7 commented 5 years ago

When start, some errors also occured Feb 17 02:00:00 ubuntu RocketChat[19688]: at packages/meteor.js:620:25 Feb 17 02:00:00 ubuntu RocketChat[19688]: at runWithEnvironment (packages/meteor.js:1356:24) Feb 17 02:01:14 ubuntu RocketChat[19688]: (node:19688) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getRedirectURL' of undefined Feb 17 02:01:14 ubuntu RocketChat[19688]: at FileUploadClass.get (packages/rocketchat:file-upload/server/config/AmazonS3.js:10:29) Feb 17 02:01:14 ubuntu RocketChat[19688]: at Object.get (packages/rocketchat:file-upload/server/lib/FileUpload.js:268:17) Feb 17 02:01:14 ubuntu RocketChat[19688]: at packages/rocketchat:file-upload/server/lib/requests.js:20:22 Feb 17 02:01:14 ubuntu RocketChat[19688]: at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40 Feb 17 02:01:14 ubuntu RocketChat[19688]: (node:19688) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) Feb 17 02:01:14 ubuntu RocketChat[19688]: (node:19688) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. Feb 17 02:02:01 ubuntu systemd[1]: Started Session 7365 of user rhlog. ^C root@ubuntu:/home/rhlog# tail /var/log/syslog -n 50 Feb 17 01:55:28 ubuntu RocketChat[19688]: at Array.forEach () Feb 17 01:55:28 ubuntu RocketChat[19688]: at continueExportOperation (packages/rocketchat:user-data-download/server/cronProcessDownloads.js:428:29) Feb 17 01:55:28 ubuntu RocketChat[19688]: at cursor.forEach.exportOperation (packages/rocketchat:user-data-download/server/cronProcessDownloads.js:467:3) Feb 17 01:55:28 ubuntu RocketChat[19688]: at SynchronousCursor.forEach (packages/mongo/mongo_driver.js:1107:16) Feb 17 01:55:28 ubuntu RocketChat[19688]: at Cursor.(anonymous function) [as forEach] (packages/mongo/mongo_driver.js:887:44) Feb 17 01:55:28 ubuntu RocketChat[19688]: at processDataDownloads (packages/rocketchat:user-data-download/server/cronProcessDownloads.js:462:9) Feb 17 01:55:28 ubuntu RocketChat[19688]: at packages/rocketchat:user-data-download/server/cronProcessDownloads.js:478:3 Feb 17 01:55:28 ubuntu RocketChat[19688]: at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1304:12) Feb 17 01:55:28 ubuntu RocketChat[19688]: at packages/meteor.js:620:25 Feb 17 01:55:28 ubuntu RocketChat[19688]: at runWithEnvironment (packages/meteor.js:1356:24) Feb 17 01:57:38 ubuntu RocketChat[19688]: ➔ System ➔ startup Feb 17 01:57:38 ubuntu RocketChat[19688]: ➔ +----------------------------------------------+ Feb 17 01:57:38 ubuntu RocketChat[19688]: ➔ | SERVER RUNNING | Feb 17 01:57:38 ubuntu RocketChat[19688]: ➔ +----------------------------------------------+ Feb 17 01:57:38 ubuntu RocketChat[19688]: ➔ | | Feb 17 01:57:38 ubuntu RocketChat[19688]: ➔ | Rocket.Chat Version: 0.74.3 | Feb 17 01:57:38 ubuntu RocketChat[19688]: ➔ | NodeJS Version: 8.11.3 - x64 | Feb 17 01:57:38 ubuntu RocketChat[19688]: ➔ | Platform: linux | Feb 17 01:57:38 ubuntu RocketChat[19688]: ➔ | Process Port: 3000 | Feb 17 01:57:38 ubuntu RocketChat[19688]: ➔ | Site URL: https://chat.cmrh.com | Feb 17 01:57:38 ubuntu RocketChat[19688]: ➔ | ReplicaSet OpLog: Enabled | Feb 17 01:57:38 ubuntu RocketChat[19688]: ➔ | Commit Hash: 202a465f1c | Feb 17 01:57:38 ubuntu RocketChat[19688]: ➔ | Commit Branch: HEAD | Feb 17 01:57:38 ubuntu RocketChat[19688]: ➔ | | Feb 17 01:57:38 ubuntu RocketChat[19688]: ➔ +----------------------------------------------+ Feb 17 02:00:00 ubuntu RocketChat[19688]: TypeError: Cannot read property 'getRedirectURL' of undefined Feb 17 02:00:00 ubuntu RocketChat[19688]: at FileUploadClass.copy (packages/rocketchat:file-upload/server/config/AmazonS3.js:29:29) Feb 17 02:00:00 ubuntu RocketChat[19688]: at Object.copy (packages/rocketchat:file-upload/server/lib/FileUpload.js:281:10) Feb 17 02:00:00 ubuntu RocketChat[19688]: at copyFile (packages/rocketchat:user-data-download/server/cronProcessDownloads.js:179:18) Feb 17 02:00:00 ubuntu RocketChat[19688]: at exportOperation.fileList.forEach.attachmentData (packages/rocketchat:user-data-download/server/cronProcessDownloads.js:429:5) Feb 17 02:00:00 ubuntu RocketChat[19688]: at Array.forEach () Feb 17 02:00:00 ubuntu RocketChat[19688]: at continueExportOperation (packages/rocketchat:user-data-download/server/cronProcessDownloads.js:428:29) Feb 17 02:00:00 ubuntu RocketChat[19688]: at cursor.forEach.exportOperation (packages/rocketchat:user-data-download/server/cronProcessDownloads.js:467:3) Feb 17 02:00:00 ubuntu RocketChat[19688]: at SynchronousCursor.forEach (packages/mongo/mongo_driver.js:1107:16) Feb 17 02:00:00 ubuntu RocketChat[19688]: at Cursor.(anonymous function) [as forEach] (packages/mongo/mongo_driver.js:887:44) Feb 17 02:00:00 ubuntu RocketChat[19688]: at Object.processDataDownloads [as job] (packages/rocketchat:user-data-download/server/cronProcessDownloads.js:462:9) Feb 17 02:00:00 ubuntu RocketChat[19688]: at packages/littledata_synced-cron.js:251:26 Feb 17 02:00:00 ubuntu RocketChat[19688]: at scheduleTimeout (packages/littledata_synced-cron.js:304:9) Feb 17 02:00:00 ubuntu RocketChat[19688]: at packages/littledata_synced-cron.js:356:42 Feb 17 02:00:00 ubuntu RocketChat[19688]: at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1304:12) Feb 17 02:00:00 ubuntu RocketChat[19688]: at packages/meteor.js:620:25 Feb 17 02:00:00 ubuntu RocketChat[19688]: at runWithEnvironment (packages/meteor.js:1356:24) Feb 17 02:01:14 ubuntu RocketChat[19688]: (node:19688) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getRedirectURL' of undefined Feb 17 02:01:14 ubuntu RocketChat[19688]: at FileUploadClass.get (packages/rocketchat:file-upload/server/config/AmazonS3.js:10:29) Feb 17 02:01:14 ubuntu RocketChat[19688]: at Object.get (packages/rocketchat:file-upload/server/lib/FileUpload.js:268:17) Feb 17 02:01:14 ubuntu RocketChat[19688]: at packages/rocketchat:file-upload/server/lib/requests.js:20:22 Feb 17 02:01:14 ubuntu RocketChat[19688]: at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40 Feb 17 02:01:14 ubuntu RocketChat[19688]: (node:19688) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) Feb 17 02:01:14 ubuntu RocketChat[19688]: (node:19688) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

EdwardWu7 commented 5 years ago

Found another strange problem, it doesn't work for pictures only(JPG、PNG、etc.)

mouragio commented 5 years ago

I have the exact same problem...

.gif files can be uploaded! (?) .png an .jpeg both give internal server error. all other file type I tried work (for instance .pdf)

mouragio commented 5 years ago

looks like it has something to do with Sharp...

error: Exception while invoking method 'ufsComplete' TypeError: sharp is not a function

sharp The typical use case for this high speed Node.js module is to convert large images in common formats to smaller, web-friendly JPEG, PNG and WebP images of varying dimensions.

Resizing an image is typically 4x-5x faster than using the quickest ImageMagick and GraphicsMagick settings.

josh-nexxt commented 3 years ago

I found this error message (TypeError: sharp is not a function) in another library. The solution was just to use const sharp = require('sharp'); instead of import * as sharp from 'sharp';

I was using the same version in another package without issue, so I am not sure what caused this - possibly something related to the Typescript config.