OfficeDev / microsoft-teams-apps-company-communicator

Company Communicator app template
MIT License
329 stars 400 forks source link

Microsoft.Bot.Schema.ErrorResponseException: Operation returned an invalid status code 'Forbidden' #1498

Closed ReivsonLopes closed 1 month ago

ReivsonLopes commented 2 months ago

I've already searched the other issues for this same error, I've tried everything that's already been suggested, but I still have the same error.

Version: 5.5.2

This error was received when trying to send messages.

Microsoft.Bot.Schema.ErrorResponseException: Operation returned an invalid status code 'Forbidden'
   at Microsoft.Bot.Connector.Conversations.ReplyToActivityWithHttpMessagesAsync(String conversationId, String activityId, Activity activity, Dictionary`2 customHeaders, CancellationToken cancellationToken)
   at Microsoft.Bot.Connector.ConversationsExtensions.ReplyToActivityAsync(IConversations operations, String conversationId, String activityId, Activity activity, CancellationToken cancellationToken)
   at Microsoft.Bot.Builder.CloudAdapterBase.SendActivitiesAsync(ITurnContext turnContext, Activity[] activities, CancellationToken cancellationToken)
   at Microsoft.Bot.Builder.TurnContext.<>c__DisplayClass31_0.<<SendActivitiesAsync>g__SendActivitiesThroughAdapter|1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.Bot.Builder.TurnContext.SendActivityAsync(IActivity activity, CancellationToken cancellationToken)
   at Microsoft.Teams.Apps.CompanyCommunicator.Common.Services.Teams.MessageService.<>c__DisplayClass3_1.<<SendMessageAsync>b__1>d.MoveNext() in C:\home\site\repository\Source\CompanyCommunicator.Common\Services\Teams\Messages\MessageService.cs:line 94
--- End of stack trace from previous location ---
   at Polly.Retry.AsyncRetryEngine.ImplementationAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates`1 shouldRetryResultPredicates, Func`5 onRetryAsync, Int32 permittedRetryCount, IEnumerable`1 sleepDurationsEnumerable, Func`4 sleepDurationProvider, Boolean continueOnCapturedContext)
   at Polly.AsyncPolicy.ExecuteAsync[TResult](Func`3 action, Context context, CancellationToken cancellationToken, Boolean continueOnCapturedContext)
   at Microsoft.Teams.Apps.CompanyCommunicator.Common.Services.Teams.MessageService.<>c__DisplayClass3_0.<<SendMessageAsync>b__0>d.MoveNext() in C:\home\site\repository\Source\CompanyCommunicator.Common\Services\Teams\Messages\MessageService.cs:line 94
tiwariShiv7 commented 2 months ago

Hi @ReivsonLopes, Thanks for reaching out Can you please Share the Screenshot of failures ? To Do this,

ReivsonLopes commented 2 months ago

Hi @tiwariShiv7!

Here is the screenshoot

image

tiwariShiv7 commented 2 months ago

Hi @ReivsonLopes, Thanks for the screenshot. Please confirm the below queries :

ReivsonLopes commented 2 months ago

Hi @tiwariShiv7!!

It's a fresh / new deployment.

in the documentation it says that permission policy is no longer used, and when going to the permission policies menu, there is image

image

image (1)

tiwariShiv7 commented 2 months ago

Hi @ReivsonLopes , Thank you !! Please help us with the deployment center as well. Could you please share the repor URL, the branch name and logs for the deployed CC instance. You can find these info by follwing the below steps - Go to Azure Portal --> Go to Resource Group (where the CC deployment has been done) --> Select Web App (App Service) --> Go to Deployment Center image

ReivsonLopes commented 2 months ago

hi @tiwariShiv7, Here are the prints as requested

image

image

ReivsonLopes commented 2 months ago

Any other sugestions @tiwariShiv7?

tiwariShiv7 commented 2 months ago

Can you also please confirm validating this

ReivsonLopes commented 2 months ago

Hello @tiwariShiv7

In my front door settings, i don't have the secont routing rule.

image

Here is the routingRule1 settings.

image

should i create a second routing rule? But i saw that the second rule is to disable, right?

tiwariShiv7 commented 2 months ago

Yes You don't need to create Second Routing Rule if it is not there

tiwariShiv7 commented 2 months ago

@ReivsonLopes Please share you contact details to connect over Teams.

ReivsonLopes commented 2 months ago

@tiwariShiv7 my teams account is reivson.lopes@hsbs.com.br

tiwariShiv7 commented 2 months ago

We have started following this issue internally.

CryogenicPotato commented 2 months ago

Same issue here, exactly as OP. We're on a fresh 5.5.2 install. For a bunch of recipients the 403 Forbidden error message is returned

image

It is not clear why it's throwing error only for a bunch of users.

microsoft-github-policy-service[bot] commented 2 months ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

microsoft-github-policy-service[bot] commented 1 month ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

v-jaygupta commented 1 month ago

Hello @ReivsonLopes ,

Connected over call to troubleshoot the issue and found the domain and bot id were missing from the user manifest package, asked to update and this fixed the issue. Please let u sknow if we can close this issue.

microsoft-github-policy-service[bot] commented 1 month ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

v-jaygupta commented 1 month ago

Closing this issue as no further action required from our side.