Rocket.chat: SlackBridge images aren't coming across

Created on 26 Jan 2017  ยท  8Comments  ยท  Source: RocketChat/Rocket.Chat

Rocket.Chat Version: Official docker image 0.50.1
Running Instances: 1
DB Replicaset OpLog: mongodb://mongo:27017/local
Node Version: whatever is included in official docker image

SlackBridge images aren't coming across again.

Messages to/from rc/slack are working as expected.

No error in log when sending image from RC, log from sending image from slack to RC below.

[34mI20170126-05:54:31.024(0) SlackBridge โž” Events.debug OnSlackEvent-MESSAGE: { type: 'message', subtype: 'file_share', text: '<@redacted|mrplowdan> uploaded a file: <https://redacted.slack.com/files/mrplowdan/redacted/logo.png|logo.png>', file: { id: 'redacted', created: 1485410069, timestamp: 1485410069, name: 'logo.png', title: 'logo.png', mimetype: 'image/png', filetype: 'png', pretty_type: 'PNG', user: 'redacted', editable: false, size: 30727, mode: 'hosted', is_external: false, external_type: '', is_public: true, public_url_shared: false, display_as_bot: false, username: '', url_private: 'https://files.slack.com/files-pri/redacted-redacted/logo.png', url_private_download: 'https://files.slack.com/files-pri/redacted-redacted/download/logo.png', thumb_64: 'https://files.slack.com/files-tmb/redacted-redacted-redacted/logo_64.png', thumb_80: 'https://files.slack.com/files-tmb/redacted-redacted-redacted/logo_80.png', thumb_360: 'https://files.slack.com/files-tmb/redacted-redacted-redacted/logo_360.png', thumb_360_w: 246, thumb_360_h: 246, thumb_160: 'https://files.slack.com/files-tmb/redacted-redacted-redacted/logo_160.png', image_exif_rotation: 1, original_w: 246, original_h: 246, permalink: 'https://redacted.slack.com/files/mrplowdan/redacted/logo.png', permalink_public: 'https://slack-files.com/redacted-redacted-redacted', channels: [ 'redacted' ], groups: [], ims: [], comments_count: 0 }, user: 'redacted', upload: true, display_as_bot: false, username: '<@redacted|mrplowdan>', bot_id: null, team: 'redacted', source_team: 'redacted', user_team: 'redacted', user_profile: { avatar_hash: '678126fd7289', image_72: 'https://avatars.slack-edge.com/2016-12-12/redacted_72.jpg', first_name: 'Dan', real_name: 'Dan', name: 'mrplowdan' }, channel: 'redacted', ts: '1485410070.000113' } I20170126-05:54:31.933(0) Exception in callback of async function: Error: Forbidden [forbidden] at Object.<anonymous> (/app/bundle/programs/server/packages/jalik_ufs.js:1066:27) at packages/matb33_collection-hooks.js:352:26 at Array.forEach (native) at Function._.each._.forEach (packages/underscore.js:139:11) at Object.<anonymous> (packages/matb33_collection-hooks.js:351:9) at Object.collection.(anonymous function) [as insert] (packages/matb33_collection-hooks.js:146:21) at [object Object].insert (/app/bundle/programs/server/packages/mongo.js:3944:38) at ModelsBaseDb.insert (/app/bundle/programs/server/packages/rocketchat_lib.js:8777:54) at [object Object].model.insert (/app/bundle/programs/server/packages/rocketchat_lib.js:8590:24) at [object Object].self.create (/app/bundle/programs/server/packages/jalik_ufs.js:887:31) at /app/bundle/programs/server/packages/rocketchat_slackbridge.js:855:35 at runWithEnvironment (packages/meteor.js:1176:24)

slackbridge

Most helpful comment

yes seeing the same issue.

Weird thing is that it also seems to add all slack users from my company to the general list, even though my bot is only tied to one channel with a handful of users. Separate issue I suppose.

All 8 comments

Are others experiencing this issue as well? Could it be a server issue?

yes seeing the same issue.

Weird thing is that it also seems to add all slack users from my company to the general list, even though my bot is only tied to one channel with a handful of users. Separate issue I suppose.

Yes same issue

We're getting Error: Forbidden [forbidden] on images uploaded by our slackbridge code, when calling const fileId = Meteor.fileStore.create(details);. I'm trying to figure out why that is happening. @rodrigok let me know if you have any clue, as I think this is related to the jalik_ufs package.

@rodrigok and @sampaiodiego any ideas?

I am getting the same issue. Images won't go through RC to Slack or Slack to RC. No error showing on RC to Slack but on Slack to RC I get:

Exception in callback of async function: Error: Forbidden [forbidden]
  at Object.<anonymous> (/opt/Rocket.Chat/programs/server/packages/jalik_ufs.js:2174:31)
  at packages/matb33_collection-hooks.js:352:26
  at Array.forEach (native)
  at Function._.each._.forEach (packages/underscore.js:139:11)
  at Object.<anonymous> (packages/matb33_collection-hooks.js:351:9)
  at Object.collection.(anonymous function) [as insert] (packages/matb33_collection-hooks.js:146:21)
  at [object Object].insert (/opt/Rocket.Chat/programs/server/packages/mongo.js:3944:38)
  at ModelsBaseDb.insert (/opt/Rocket.Chat/programs/server/packages/rocketchat_lib.js:8838:54)
  at [object Object].model.insert (/opt/Rocket.Chat/programs/server/packages/rocketchat_lib.js:8651:24)
  at Store.self.create (/opt/Rocket.Chat/programs/server/packages/jalik_ufs.js:1993:35)
  at /opt/Rocket.Chat/programs/server/packages/rocketchat_slackbridge.js:855:35
  at runWithEnvironment (packages/meteor.js:1176:24)

Hi I'm investigate this issue and found that in FileUploadBase.js line 6 it's return undefined that cause Forbidden error from jalik-ufs when it try to check permission before insert data (ufs-store.js line 339)

I'm don't know why userId in FileUploadBase.js is undefined but below is just quick fix this issue not sure is it a good way or not or should I use the same way to check permission as it shown in update and remove functions ?

UploadFS.config.defaultStorePermissions = new UploadFS.StorePermissions({
    insert(userId/*, doc*/) {
        if (userId) {
            return userId;
        }
        return true;
    },
    update(userId, doc) {
        return RocketChat.authz.hasPermission(Meteor.userId(), 'delete-message', doc.rid) || (RocketChat.settings.get('Message_AllowDeleting') && userId === doc.userId);
    },
    remove(userId, doc) {
        return RocketChat.authz.hasPermission(Meteor.userId(), 'delete-message', doc.rid) || (RocketChat.settings.get('Message_AllowDeleting') && userId === doc.userId);
    }
});

๐Ÿ’—๐Ÿ’™๐Ÿ’š๐Ÿ’›๐Ÿ’œ
Can't wait to test this out!
Thanks a bunch

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kiran-Rao picture Kiran-Rao  ยท  3Comments

ghost picture ghost  ยท  3Comments

lunitic picture lunitic  ยท  3Comments

engelgabriel picture engelgabriel  ยท  3Comments

brendanheywood picture brendanheywood  ยท  3Comments