This repository was archived by the owner on Dec 4, 2023. It is now read-only.
Repository navigation
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.bugIndicates an unexpected problem or an unintended behavior.customer-reportedIssue 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.
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.bugIndicates an unexpected problem or an unintended behavior.customer-reportedIssue 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.
Activity
[-]Fetch Team Channels throw a ErrorResponseException[/-][+]Fetch Team Channels throws a ErrorResponseException[/+][-]Fetch Team Channels throws a ErrorResponseException[/-][+]Fetch Team Channels throws an ErrorResponseException[/+]tracyboehrer commentedon Feb 4, 2021
Joseph Blair (@jpblair) This will be included in the next preview release, which should be around Feb. 15-ish.
masumkabir commentedon Feb 16, 2021
tracyboehrer (@tracyboehrer)
Any approximate delivery date of next 4.6.0-preview8 release?
tracyboehrer commentedon Feb 16, 2021
Masum Kabir (@masumkabir) We will likely be starting the builds for all platforms some time this week.
stroganovmaxv commentedon Feb 18, 2021
tracyboehrer (@tracyboehrer), the method
TeamsInfo.getTeamDetails(turnContext, null).join();is still not working:com.microsoft.bot.connector.rest.ErrorResponseException: Status code 405, {"message":"The requested resource does not support http method 'POST'."}Could you please estimate when the fix of the
getTeamDetails()method will ship to Maven repository?tracyboehrer commentedon Feb 18, 2021
Maxim Stroganov (@stroganovmaxv) A test version of 4.6.0-preview8 should be available on Maven now. It has not been officially released though.
stroganovmaxv commentedon Feb 18, 2021
tracyboehrer (@tracyboehrer) I use the 4.6.0-preview8 version -
TeamsInfo.getTeamChannels()is working, butTeamsInfo.getTeamDetails()is still not workingtracyboehrer commentedon Feb 18, 2021
Maxim Stroganov (@stroganovmaxv) Ah. Apologies. Since this issue was about getTeamsChannels, we failed to evaluate the other calls. I can push a patch version. 4.6.1-preview8. Give me a bit.