Forum Discussion
amatthews-yakchat
May 25, 2022Copper Contributor
Operation returned an invalid status code 'Forbidden'/'NotFound'
I am having a recurring problem with our Bot in Teams that I am struggling to find a root cause and fix for. We have a bot that has been developed using the C# Bot Framework SDK Version 4 and .NE...
Sayali-MSFT
Microsoft
May 26, 2022amatthews-yakchat- Could please share the any referred sample or repro steps,So that we can tried it from our end?
- Sayali-MSFTJun 03, 2022
Microsoft
amatthews-yakchat-We are not able to reproduce the scenario.Could you please share the any referred sample or repro steps, So that we can investigate it from our end?- amatthews-yakchatJun 06, 2022Copper Contributor
Sayali-MSFT Apologies for the delayed response, I was on vacation for the last week. I'm not sure what the repro steps are for this issue as it happens intermittently and looking at the telemetry there doesn't seem to be any common ground or any cases where it happens 100% of the time.
I've included the area of code where I think the error originates from below. Like I mentioned in my original post, we are using the WaterfallDialog approach with this bot and this is one of the steps, the error seems to be thrown when moving away from this step to the next.
private async Task<DialogTurnResult> PromptStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { try { UserProfile Profile = await this._stateAccessor.GetAsync(stepContext.Context, () => new UserProfile()); if (String.IsNullOrWhiteSpace(stepContext.Context.Activity.Text)) { if (!String.IsNullOrWhiteSpace(Profile.CachedMessage)) { stepContext.Context.Activity.Text = Profile.CachedMessage; Profile.CachedMessage = String.Empty; } } return await stepContext.BeginDialogAsync(nameof(OAuthPrompt), null, cancellationToken); } catch (Exception exc) { Dictionary<String, String> Properties = new Dictionary<String, String>(); Properties.Add("Class", "MainDialog"); Properties.Add("Method", "PromptStepAsync"); AppInsightsHelper.LogException(exc, Properties, stepContext.Context); await stepContext.Context.SendActivityAsync(BotResponse.ErrorMessage_GenericErrorResponse); return await stepContext.EndDialogAsync(cancellationToken: cancellationToken); } }
- Sayali-MSFTJun 09, 2022
Microsoft
amatthews-yakchat -We are tried with the following sample. It works for us .Could you please check it once from your end some points?
1.have you added bot auth on your azure bot and url in same format correct ?
2.In App Setting check the connection name?
Sample Link-
https://github.com/microsoft/BotBuilder-Samples/tree/14ed6ea596aa84d2b561d00f58f828ae8cc1a89a/samples/csharp_dotnetcore/46.teams-auth