This repository was archived by the owner on Dec 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 113
This repository was archived by the owner on Dec 4, 2023. It is now read-only.
Fetch Team Channels throws an ErrorResponseException #843
Copy link
Copy link
Closed
Labels
Bot ServicesRequired for internal Azure reporting. Do not delete. Do not change color.Required for internal Azure reporting. Do not delete. Do not change color.bugIndicates an unexpected problem or an unintended behavior.Indicates an unexpected problem or an unintended behavior.customer-reportedIssue is created by anyone that is not a collaborator in the repository.Issue is created by anyone that is not a collaborator in the repository.needs-triageThe issue has just been created and it has not been reviewed by the team.The issue has just been created and it has not been reviewed by the team.
Description
Affected Versions
Tested it in 4.6.0-preview8 and 4.6.0-preview7
Descriptions
When fetching the channel list of a team:
List<ChannelInfo> channels = TeamsInfo
.getTeamChannels(turnContext, teamInfo.getId())
.get();
The following exception is thrown:
java.util.concurrent.ExecutionException: com.microsoft.bot.connector.rest.ErrorResponseException: Status code 405, {"message":"The requested resource does not support http method 'POST'."}
at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2063)
at com.newswhip.teams.BotActivityHandler.onTeamsMembersAdded(BotActivityHandler.java:119)
at com.microsoft.bot.builder.teams.TeamsActivityHandler.onTeamsMembersAddedDispatch(TeamsActivityHandler.java:691)
at com.newswhip.teams.BotActivityHandler.onTeamsMembersAddedDispatch(BotActivityHandler.java:352)
at com.microsoft.bot.builder.teams.TeamsActivityHandler.onConversationUpdateActivity(TeamsActivityHandler.java:530)
at com.newswhip.teams.BotActivityHandler.onConversationUpdateActivity(BotActivityHandler.java:312)
at com.microsoft.bot.builder.ActivityHandler.onTurn(ActivityHandler.java:74)
at com.microsoft.bot.integration.BotFrameworkHttpAdapter$$Lambda$504/0000000000000000.invoke(Unknown Source)
at com.microsoft.bot.builder.MiddlewareSet.receiveActivityInternal(MiddlewareSet.java:99)
at com.microsoft.bot.builder.MiddlewareSet.lambda$receiveActivityInternal$1(MiddlewareSet.java:110)
at com.microsoft.bot.builder.MiddlewareSet$$Lambda$552/0000000000000000.next(Unknown Source)
at com.microsoft.bot.builder.BotFrameworkAdapter$TenantIdWorkaroundForTeamsMiddleware.onTurn(BotFrameworkAdapter.java:1552)
at com.microsoft.bot.builder.MiddlewareSet.receiveActivityInternal(MiddlewareSet.java:109)
at com.microsoft.bot.builder.MiddlewareSet.receiveActivityInternal(MiddlewareSet.java:74)
at com.microsoft.bot.builder.MiddlewareSet.receiveActivityWithStatus(MiddlewareSet.java:67)
at com.microsoft.bot.builder.BotAdapter.runPipeline(BotAdapter.java:194)
at com.microsoft.bot.builder.BotFrameworkAdapter.lambda$processActivity$2(BotFrameworkAdapter.java:475)
at com.microsoft.bot.builder.BotFrameworkAdapter$$Lambda$551/0000000000000000.apply(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1183)
at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2299)
at com.microsoft.bot.builder.BotFrameworkAdapter.processActivity(BotFrameworkAdapter.java:473)
at com.microsoft.bot.builder.BotFrameworkAdapter.lambda$processActivity$1(BotFrameworkAdapter.java:435)
at com.microsoft.bot.builder.BotFrameworkAdapter$$Lambda$510/0000000000000000.apply(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1146)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1769)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1756)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: com.microsoft.bot.connector.rest.ErrorResponseException: Status code 405, {"message":"The requested resource does not support http method 'POST'."}
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at com.microsoft.bot.rest.ServiceResponseBuilder.build(ServiceResponseBuilder.java:122)
at com.microsoft.bot.azure.AzureResponseBuilder.build(AzureResponseBuilder.java:56)
at com.microsoft.bot.connector.rest.RestTeamsOperations.fetchChannelListDelegate(RestTeamsOperations.java:84)
at com.microsoft.bot.connector.rest.RestTeamsOperations.lambda$fetchChannelList$0(RestTeamsOperations.java:65)
at com.microsoft.bot.connector.rest.RestTeamsOperations$$Lambda$643/0000000000000000.apply(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2137)
at retrofit2.CompletableFutureCallAdapterFactory$ResponseCallAdapter$2.onResponse(CompletableFutureCallAdapterFactory.java:119)
at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:129)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:174)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:851)
Solution
That happens because the v3/teams/{teamId}/conversations
call is a POST in the code, but it should be a GET according to the Bot API documentation:
https://docs.microsoft.com/en-us/microsoftteams/platform/resources/bot-v3/bots-context
I'll submit a PR with the fix.
Metadata
Metadata
Assignees
Labels
Bot ServicesRequired for internal Azure reporting. Do not delete. Do not change color.Required for internal Azure reporting. Do not delete. Do not change color.bugIndicates an unexpected problem or an unintended behavior.Indicates an unexpected problem or an unintended behavior.customer-reportedIssue is created by anyone that is not a collaborator in the repository.Issue is created by anyone that is not a collaborator in the repository.needs-triageThe issue has just been created and it has not been reviewed by the team.The issue has just been created and it has not been reviewed by the team.