Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Fetch Team Channels throws an ErrorResponseException #843

Closed

Description

@vini-desouza

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.

Activity

  1. added
    bug
    needs-triage
    on Nov 25, 2020
  2. changed the title [-]Fetch Team Channels throw a ErrorResponseException[/-] [+]Fetch Team Channels throws a ErrorResponseException[/+] on Nov 25, 2020
  3. changed the title [-]Fetch Team Channels throws a ErrorResponseException[/-] [+]Fetch Team Channels throws an ErrorResponseException[/+] on Nov 25, 2020
  4. added
    Bot Services
    customer-reported
    on Nov 25, 2020
  5. tracyboehrer commented on Feb 4, 2021

    @tracyboehrer
    Member

    Joseph Blair (@jpblair) This will be included in the next preview release, which should be around Feb. 15-ish.

  6. masumkabir commented on Feb 16, 2021

    @masumkabir

    Joseph Blair (@jpblair) This will be included in the next preview release, which should be around Feb. 15-ish.

    tracyboehrer (@tracyboehrer)
    Any approximate delivery date of next 4.6.0-preview8 release?

  7. tracyboehrer commented on Feb 16, 2021

    @tracyboehrer
    Member

    Masum Kabir (@masumkabir) We will likely be starting the builds for all platforms some time this week.

  8. stroganovmaxv commented on Feb 18, 2021

    @stroganovmaxv

    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?

  9. tracyboehrer commented on Feb 18, 2021

    @tracyboehrer
    Member

    Maxim Stroganov (@stroganovmaxv) A test version of 4.6.0-preview8 should be available on Maven now. It has not been officially released though.

  10. stroganovmaxv commented on Feb 18, 2021

    @stroganovmaxv

    tracyboehrer (@tracyboehrer) I use the 4.6.0-preview8 version - TeamsInfo.getTeamChannels() is working, but TeamsInfo.getTeamDetails() is still not working

  11. tracyboehrer commented on Feb 18, 2021

    @tracyboehrer
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Bot Servicesbugcustomer-reportedneeds-triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions