alexkvak / teamcity-slack

TeamCity Slack plugin
MIT License
123 stars 23 forks source link

Unable to find slack channel #121

Closed sushilgl closed 3 years ago

sushilgl commented 3 years ago

Followed all the instructions, while configuring channel I get below error

Unable to find channel with name teamcitybuild

image

teamcitybuild is new channel added for the notification.

Are any additional steps required for configuration?

Environment: TeamCity Professional 2019.2.2 (build 71923) teamcity-slack v2.0.1

alexkvak commented 3 years ago

Did you add the bot to this channel?

Please take a look at teamcity-server.log under Administration -> Diagnostics

sushilgl commented 3 years ago

Yes bot was added to the channel

I can see below log jetbrains.buildServer.SERVER - Slack Integration - missing_scope

mix4242 commented 3 years ago

Experienced same error

I've added a bunch of extra scopes (unable to say which scopes[s] in particular made it work - when I remove all scopes it continues to work...) and the missing_scope stopped and I was able to save the configuration. However on pressing Try it I get the following:

LOG ``` [2021-04-01 14:09:09,259] ERROR - jetbrains.buildServer.SERVER - Error java.lang.NullPointerException; while processing request: POST '/app/slackIntegration/buildSettingTry.html?id=*REDACTED*', from client *REDACTED* (*REDACTED*), authenticated as '*REDACTED*' (*REDACTED*) {id=*REDACTED*} java.lang.NullPointerException at com.fpd.teamcity.slack.controllers.BuildSettingsTry$.filterMatchBuild(BuildSettingsTry.scala:96) at com.fpd.teamcity.slack.controllers.BuildSettingsTry$.$anonfun$findPreviousBuild$1(BuildSettingsTry.scala:115) at scala.Option.flatMap(Option.scala:283) at com.fpd.teamcity.slack.controllers.BuildSettingsTry$.findPreviousBuild(BuildSettingsTry.scala:114) at com.fpd.teamcity.slack.controllers.BuildSettingsTry.$anonfun$handle$1(BuildSettingsTry.scala:57) at scala.util.Try$.apply(Try.scala:210) at com.fpd.teamcity.slack.controllers.BuildSettingsTry.handle(BuildSettingsTry.scala:50) at com.fpd.teamcity.slack.controllers.SlackController.doHandle(SlackController.scala:23) at com.fpd.teamcity.slack.controllers.SlackController.doHandle$(SlackController.scala:18) at com.fpd.teamcity.slack.controllers.BuildSettingsTry.doHandle(BuildSettingsTry.scala:29) at jetbrains.buildServer.controllers.BaseController.handleRequestInternal(BaseController.java:114) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:174) at jetbrains.buildServer.controllers.BaseController.handleRequest(BaseController.java:93) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:50) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) at jetbrains.buildServer.maintenance.WebDispatcherServlet.doService(WebDispatcherServlet.java:32) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) at javax.servlet.http.HttpServlet.service(HttpServlet.java:652) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) at jetbrains.buildServer.maintenance.TeamCityDispatcherServlet.processedByMainServlet(TeamCityDispatcherServlet.java:38) at jetbrains.buildServer.maintenance.TeamCityDispatcherServlet.service(TeamCityDispatcherServlet.java:1) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at jetbrains.buildServer.web.jsp.JspPrecompilerFilter.doFilter(JspPrecompilerFilter.java:31) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at jetbrains.buildServer.web.DisableSessionIdFromUrlFilter.doFilter(DisableSessionIdFromUrlFilter.java:4) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at jetbrains.buildServer.web.UserIdProviderFilter.doFilter(UserIdProviderFilter.java:1) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at jetbrains.buildServer.web.NodeInfoHeaderFilter.doFilter(NodeInfoHeaderFilter.java:2) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:107) at jetbrains.buildServer.diagnostic.web.DiagnosticFilter.doFilter(DiagnosticFilter.java:79) at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:112) at jetbrains.buildServer.web.DependencyParametersCalculationContextFilter.doFilter(DependencyParametersCalculationContextFilter.java:5) at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:112) at jetbrains.buildServer.diagnostic.web.HttpRequestsDurationMetricsReporter.doFilter(HttpRequestsDurationMetricsReporter.java:12) at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:112) at jetbrains.buildServer.web.HttpSecurityHeadersFilter.doFilter(HttpSecurityHeadersFilter.java:26) at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:112) at jetbrains.buildServer.controllers.filters.ClearSecurityContextFilter.doFilter(ClearSecurityContextFilter.java:17) at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:112) at org.springframework.web.filter.CompositeFilter.doFilter(CompositeFilter.java:73) at jetbrains.buildServer.web.DelegatingFilter.doFilter(DelegatingFilter.java:74) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at jetbrains.buildServer.web.ResponseFragmentFilter.doFilter(ResponseFragmentFilter.java:32) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:544) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:616) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:831) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1634) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Thread.java:829) ```

The TC build configuration has ran builds in past and previous successful/failed builds do exist.

Configuration ![Screenshot 2021-04-01 at 15 20 02](https://user-images.githubusercontent.com/5556295/113308201-d9007880-92fd-11eb-8a04-b9a74125738a.png)
sushilgl commented 3 years ago

Thank you mix4242, few more scopes were added and it worked for me.

alexkvak commented 3 years ago

@mix4242 it seems that you have another one issue which is fixed in #122

Anyway thanks for report and your participation!

mix4242 commented 3 years ago

Thanks for fixing the other issue so quickly @alexkvak!

Do we know what specific scopes were missing? @sushilgl could you share which ones you added? Would be good to update the README for future users :)

sushilgl commented 3 years ago

I am not sure on the exact scope but my scopes for the app are listed below. TeamCity Build Service is the name of my app. Authorizations On behalf of users, TeamCity Build Service can: View information about a user’s identity, granted by 1 team member View messages and other content in a user’s public channels, granted by 1 team member View people in a workspace, granted by 1 team member View email addresses of people in a workspace, granted by 1 team member Manage a user’s public channels and create new ones on a user’s behalf, granted by 1 team member Send messages on a user’s behalf, granted by 1 team member Manage a user’s private channels and create new ones on a user’s behalf, granted by 1 team member Start and manage calls in a workspace, granted by 1 team member View information about ongoing and past calls, granted by 1 team member On behalf of the app, TeamCity Build Service can: View basic information about public channels in a workspace Send messages as @teamcity_build_servic Send messages to channels @teamcity_build_servic isn't a member of Start direct messages with people View people in a workspace View email addresses of people in a workspace Send messages as @teamcity_build_servic with a customized username and avatar View information about ongoing and past calls Start and manage calls in a workspace View messages and other content in public channels that TeamCity Build Service has been added to Join public channels in a workspace Set presence for TeamCity Build Service View messages that directly mention @teamcity_build_servic in conversations that the app is in Manage public channels that TeamCity Build Service has been added to and create new ones View files shared in channels and conversations that TeamCity Build Service has been added to Upload, edit, and delete files as TeamCity Build Service Add, remove, or mark reminders as complete View the name, email domain, and icon for workspaces TeamCity Build Service is connected to Add shortcuts and/or slash commands that people can use View Do Not Disturb settings for people in a workspace View custom emoji in a workspace View messages and other content in private channels that TeamCity Build Service has been added to View basic information about private channels that TeamCity Build Service has been added to Manage private channels that TeamCity Build Service has been added to and create new ones View messages and other content in direct messages that TeamCity Build Service has been added to View basic information about direct messages that TeamCity Build Service has been added to Post messages to specific channels in Slack Add steps that people can use in Workflow Builder Post messages to private group

groaks commented 3 years ago

Had the same issue, after digging into the code, call that failing is using this API https://api.slack.com/methods/conversations.list. According to the doc required scopes are:

after adding those everything worked

alexkvak commented 3 years ago

@groaks thanks for the investigation! Added missing scopes to README