Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slack Integration: Inability to connect private channel #7897

Closed
tkharuk opened this issue Apr 3, 2018 · 47 comments · Fixed by #19446
Closed

Slack Integration: Inability to connect private channel #7897

tkharuk opened this issue Apr 3, 2018 · 47 comments · Fixed by #19446

Comments

@tkharuk
Copy link

tkharuk commented Apr 3, 2018

Reporting Bugs

New sentry plugin cannot be connected to private channel even though sentry is added to it.

  • raven v3.22.3

The slack resource "sentry-notifications" does not exist or has not been granted access in the {workspace-name} Slack workspace.

screen shot 2018-04-03 at 6 35 20 pm

Additional Notes:

  • old sentry notifications worked with private channels
  • old sentry notifications have a button to test the connection with dummy event
  • the new plugin seems to connect to public channel

Edit by @evanpurkhiser: See @wedamija's comment here: #7897 (comment)

@evanpurkhiser
Copy link
Member

Thanks for the report!

We added support for reporting to private channels just yesterday 18ae499.

Because of how Slack apps work, and because the ability to verify that the integration has access to private channels requires a new permission, you will need to re-install the integration. You can simply click 'Add Integration' and go through the setup again (without needing to remove the already configured workspace) and it will grant you the new permissions.

You've already got the app added into the private channel, but for other private channels you might want to add it into you can simply issue /invite @Sentry in your slack workspace!

Let me know if there's any problems!

@tkharuk
Copy link
Author

tkharuk commented Apr 4, 2018

Hi, thanks for quick response.

I had to remove workspace and to add it anew for it to work.
But it was quick since alert rules and everything else was intact.

Probably not a place to mention this, but maybe you can give me a quick reference:

  • I've added a comma-separated list of tags but it did not seem to affect notification format. I've used "project, release, environment, url, user"

@SuEric
Copy link

SuEric commented Apr 4, 2018

hey @evanpurkhiser , I just added the integration this morning (1 hour ago). And I'm getting same error message when attempting to edit the rule so it posts to my private channel.

screen shot 2018-04-04 at 9 31 25 am

screen shot 2018-04-04 at 9 31 59 am

I tried entering both "#naranja-mecanica" and "naranja-mecanica". None worked..

NOTE: I used "GLOBAL INTEGRATIONS"

It is first time I added Sentry Slack integration; no looks like it is not fixed..?

@SuEric
Copy link

SuEric commented Apr 4, 2018

Actually this is what I see for my Sentry Slack app settings:

screen shot 2018-04-04 at 9 47 45 am

So why do I get the error when trying to setup the alert rule?

@tkharuk
Copy link
Author

tkharuk commented Apr 4, 2018

@SuEric what helped in my case:

  • remove workspace
  • add new workspace
  • grant permissions to all public channels

My previously added via slack private channel was already listed in settings as added individually.

@evanpurkhiser
Copy link
Member

grant permissions to all public channels

Ahh this just clicked, this is likely the issue here. Will look into this in the next couple hours :)

@evanpurkhiser
Copy link
Member

Fix going out right now for this! #7929

@evanpurkhiser
Copy link
Member

Also @TuxujPes

I've added a comma-separated list of tags but it did not seem to affect notification format. I've used "project, release, environment, url, user"

That's fixed in #7928 :) Also going out atm

@ericjeker
Copy link

To me this still does not work. I have added the workspace in my sentry integrations, then invited the Sentry app to the private channel but I still have the same error.

image

image

I tried to reference the channel with # or @ but that doesn't change anything. What am I doing wrong?

@evanpurkhiser
Copy link
Member

You're able to add it to public channels right @ericjeker ?

@ericjeker
Copy link

You're able to add it to public channels right @ericjeker ?

Yes, public channels are fine. But not the private ones. I tried to reinstall the workspace also but it didn't work.

@evanpurkhiser evanpurkhiser reopened this Jan 25, 2019
@evanpurkhiser
Copy link
Member

evanpurkhiser commented Jan 25, 2019

@ericjeker does your slack have a lot of channels? #11064 is potentially related.

@ericjeker
Copy link

ericjeker commented Jan 26, 2019

Currently we have about 30 private channels and hidden channels. So no we are not up to 1000 channels.

@twidii
Copy link

twidii commented Jan 31, 2019

Yasss, what should you guys do is just click on "All Public Channels" on Sentry Settings
image thanks @evanpurkhiser 👍

@NerdyParker
Copy link

I'm still having this issue. I've tried removing/adding the workspace. Kicking/inviting the app from the channel. Still getting the error mentioned above.

@tomjennings100
Copy link

I have the same issue, Sentry is explicitly added to our shared workspace but cannot see it.

@lcmartinezdev
Copy link

I have the same issue, I 've tried removing and adding the sentry slack app but didn't work.

@juancarlosfarah
Copy link

I'm actually seeing the same issue as well.

@lcmartinezdev
Copy link

lcmartinezdev commented Mar 21, 2019

@evanpurkhiser Can we do something? Can we help you with something? Thanks.

@jwarlander
Copy link

Seeing problems adding Sentry to private channels here, too, @evanpurkhiser..

It's not unlikely that our workspace might have > 1000 channels (how would I even know?) as we're around 8k users, so possibly we're affected by #11064 - any work happening there? It seems to have stalled a bit :)

@Aarbel
Copy link

Aarbel commented Mar 26, 2019

Can't send alerts to private channels too.

Do you know a way to fix it ?

SENTRY SCREENSHOT
image

SLACK SCREENSHOT
image

@lcmartinezdev
Copy link

I have checked and its because sentry uses old endpoint: (does not include private channels.)

https://api.slack.com/methods/channels.list

resp = session.get('https://slack.com/api/channels.list', params=channels_payload)

@Aarbel
Copy link

Aarbel commented Mar 27, 2019

@evanpurkhiser

@evanpurkhiser
Copy link
Member

evanpurkhiser commented Mar 28, 2019

@lcmartinezdev keep reading :)

# Channel may be private
resp = session.get('https://slack.com/api/groups.list', params=channels_payload)
resp = resp.json()
if not resp.get('ok'):
self.logger.info('rule.slack.group_list_failed', extra={'error': resp.get('error')})
return None

However, I can also reproduce this in production.

We're unfortunately a little bit at the mercy of slack right now, as we're on their "new-but-depcreated" workspaces API (See #9004). But it very well could be that slack has made some kind of breaking change.

We're working with slack right now to get some fixes in (which requires their intervention with our "legacy worksapce app") so I ask that you guys sit tight, and we'll update this thread when we can get a fix in place.

@lcmartinezdev
Copy link

I didn't see it.
So thanks for your help.

@alcohol
Copy link

alcohol commented May 15, 2019

Is a fix for this still in progress?

@evanpurkhiser
Copy link
Member

I'd actually love to hear from you guys again specifically from those who are:

  • Using sentry.io (not on-premise)
  • Don't have a lot of slack channels
  • See this error

Let em know your sentry organization slug and @wedamija or myself can take a closer look at what's going on.

@lcmartinezdev
Copy link

@evanpurkhiser My organization slug is:
acuasoft

Let me know if I can help with some action.

Thanks

@evanpurkhiser
Copy link
Member

@lcmartinezdev if it's not a problem to ask publicly, what is the name of the private channel you're trying to add?

@lcmartinezdev
Copy link

@evanpurkhiser
The channel name is: dev_acuasoft
The full url is: https://acuasoft.slack.com/messages/CDCDZBE0Y/

@wedamija
Copy link
Member

wedamija commented Jun 10, 2019

@lcmartinezdev I've been investigating your issue. When I tested this with my own private channel I was unable to reproduce, but I could easily reproduce it with yours, and so reached out to Slack to figure out what's going wrong.

Unfortunately, it turns out that this is a known bug on Slack's side. The issue occurs only with channels that were previously public and then converted over to private, and we're just not able to access them via our workspace app due to this bug.

For the moment there's not a lot we can do to help you out. Slack will let us know when they've resolved the issue, and as a workaround you could create a new private channel and that should work as expected with our integration.

@lcmartinezdev
Copy link

@wedamija Thanks.

I will ask to Slack support in order to know how to fix the issue.

@fabriciols
Copy link

have the same problem here, hoping for a fix...

@ivan-pomortsev
Copy link

What helped me is creating new private channel and then adding Sentry app (/invite @Sentry).

@iagomelanias
Copy link

iagomelanias commented Jul 16, 2019

@evanpurkhiser actually, the documentation says this behavior is intentional.

Don't use this method. Use conversations.list instead.
...
Does not include private shared channels or channels that have been converted from public to private. Use the Conversations API instead.

While deleting the channel and creating it again might be a good way to go, we lose all the channel history, months and months of discussions, plannings, etc. The only option available is to use corporate exports, which requires a Plus plan and manual approval...

It would be great if the new method conversations.list was implemented. It has been extremely frustrating not to be able to integrate Sentry into some of our channels. 🙁

@silvez-dh
Copy link

Hello, no news on this issue? Tks :)

@silvez-dh
Copy link

Btw, it works for private channels (created a new one here and worked) but not for public ones

@silvez-dh
Copy link

silvez-dh commented Aug 14, 2019

Contacted Slack support and follow their answer:

Hi Bruno,

Thanks for writing in and sorry for the troubles. Unfortunately this is something that Sentry will need to support in their app. Based on what I'm reading in that Issue thread, it looks like they're still using the channels.* and groups.* API methods instead of the conversations.* methods.

Once that's implemented, it should be able to support private conversations. If Sentry is not responsive in that GitHub issue, you can try reaching them at support@sentry.io.

Sorry that I don't have better news for you today, but let me know if you have any questions.

@berik
Copy link

berik commented Oct 24, 2019

What helped me is creating new private channel and then adding Sentry app (/invite @Sentry).

This method helped me

@gonengar
Copy link

gonengar commented Nov 5, 2019

Didn't manage to integrate newly created public channel(Altough in sentry.io it works like a charm)

@omaraltayyan
Copy link

still an issue, can integrate with public channels, but not private ones, i have added many permissions to the slack app, and added the sentry app to my private channel, still shows this error:

The slack resource "...." does not exist or has not been granted access in the ... Slack workspace.

@w3box
Copy link

w3box commented Feb 10, 2020

still an issue, can integrate with public channels, but not private ones, i have added many permissions to the slack app, and added the sentry app to my private channel, still shows this error:

The slack resource "...." does not exist or has not been granted access in the ... Slack workspace.

same here

@flowdee
Copy link

flowdee commented Mar 16, 2020

Will this ever be possible? Really annoying

Update: Used a workaround via Zapier.

@flyte
Copy link

flyte commented Mar 24, 2020

Ugh. I had this working for months, but then I needed to change the alert settings to only send alerts on specific environments. I removed our existing integration and now I'm not able to configure alerts to private channels either.

We cannot post sentry alerts to public channels because of potential sensitive information held within them. This is a crucial feature in my opinion, and it sucks that we've just lost it, having had it before.

PS. we're using sentry.io and get the same error as others:

The slack resource "...." does not exist or has not been granted access in the ... Slack workspace.

Edit:

Got it to work by reading the rest of the comments in here and creating a new private channel to use since we must have created the channel as public previously and then made it private. That's an annoying bug.

@kkmuffme
Copy link

kkmuffme commented Apr 5, 2020

You can actually easily fix it by manually adding the private channel to the integration.

Open slack in your browser & navigate to the apps. Select Sentry => Settings => click on "Add App to channel" button. Search for the private channel in the input field that shows, then click it to add.
Now you can create alerts for the private channel without getting that error.

@dmitrygusev
Copy link

There's a trick to make it post to a private channel that was public before, if you really need it, by directly updating alert rule configuration in DB.

Suppose you have a channel name: #channel-name

  1. Find ID of the channel. The simplest way is probably open the slack channel in a browser, and take ID from the URL, i.e.: https://app.slack.com/client/xxx/CHANNELID

  2. Create a rule with desired configuration in your project, just temporarily put a channel name that works, i.e. new private channel you just created. We will replace it soon.

  3. Connect to Sentry DB and find the rule you created at previous step, label and project_id columns should help you identify the right one, assuming our record has id = 1:

    sentry => SELECT data FROM sentry_rule WHERE id = 1;
    
    eF5VUD1vgzAU3N+viNSBDAmqgUAYadShS1UJyStyzQux4hjXNlT5933Op7pxd+be3S17y6BN5Gh6FdRofAI2g6W2OSx7WwA/iSAPYDfA5Qi2BM9FCE59TwHBVsDRzMqN5oQmgN2SrHqwNXBPhDunbtLo06d9ijMJ3cMjfY+4ucPd/SFY9kpms9AT3WGMDIMYlBkIZOCFb5O9w58JjTxTZJbDBysK+qVNhIwG3SV4lArqJ7SOn5unHouyMjZlVazKtsDpgie2/tdqtXCoUXhcLaxTRior9Grh0c3oOiNOxOtxGNDRcJf78iCMQd2pPm5JyXdN/VbVX3lJkLLz39EdvRWSimU58Pw2WlY8VlMm4ODEdTGvhTymZgxqf+6u4dM2cp8XqqUkSmIjr7Nl1JHfIhAqgb8IjS74db5+TJhVccIU/gAhvqmm
  4. The data is base64 encoded deflated text in a special text format. We need to extract it into a file as text for editing. One way to do it on Mac OS is just copy above string to clipboard and run:

     pbpaste | base64 -D | pigz -d > data
  5. Edit the data file preserving line endings (i.e. using vim): replace fields p21 and p26 with correct channel-id and name; note channel ID should be prefixed with V, same as channel name, i.e.:

    ...
    sS'channel_id'
    p21
    VCHANNELID
    p22
    sVworkspace
    p23
    V3
    sVid
    p24
    Vsentry.integrations.slack.notify_action.SlackNotifyServiceAction
    p25
    sVchannel
    p26
    V#channel-name
    p27
    ...
    
  6. Encode the file back to the Sentry format, i.e. to get encoded data in clipboard for Mac OS:

    cat data | pigz -z | base64 | pbcopy
  7. Update record in DB:

    UPDATE sentry_rule SET data = '<paste new payload>' WHERE id = 1;

This should be everything.

You will not be able to edit the form again as it will keep failing validation on save, but Sentry should be able to use stored value. If you need to change anything, just repeat above steps.

@haganf
Copy link

haganf commented May 20, 2020

I had a similar problem, ended up we have two sentry apps installed in our slack workspace: @sentry (capital S, orange icon) and @sentry (pink icon). The @sentry is the new version which worked for us.

dcshiman added a commit to dcshiman/sentry that referenced this issue Jun 18, 2020
Slack api https://slack.com/api/channels.* is deprecated see:
https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api
All new slack apps created after June 10th, 2020 will give error, which
creates issue for on premise sentry.

This commit fixes the issue by adding `slack.legacy-app=(true/false)`
config so that it continues support for legacy slack apps while new apps
can toggle this option for new slack API support

Resolves: getsentry#7897
dcshiman added a commit to dcshiman/sentry that referenced this issue Jun 18, 2020
Slack api https://slack.com/api/channels.* is deprecated see:
https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api
All new slack apps created after June 10th, 2020 will give error, which
creates issue for on premise sentry.

This commit fixes the issue by adding `slack.legacy-app=(true/false)`
config so that it continues support for legacy slack apps while new apps
can toggle this option for new slack API support

Resolves: getsentry#7897
scefali pushed a commit that referenced this issue Jun 19, 2020
Slack api https://slack.com/api/channels.* is deprecated see:
https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api
All new slack apps created after June 10th, 2020 will give error, which
creates issue for on premise sentry.

This commit fixes the issue by adding `slack.legacy-app=(true/false)`
config so that it continues support for legacy slack apps while new apps
can toggle this option for new slack API support

Resolves: #7897
@github-actions github-actions bot locked and limited conversation to collaborators Dec 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.