Operation returned an invalid status code 'Gone'
Bot Info
- Bot Framework SDK Version: 4.3.2
- SDK Platform: .NET Core 2.2
- Active Channels: Skype Webchat
- Deployment Environment: Azure App Service (West US)
I am facing the below issue after deploying the bot. The bot is working fine in the local emulator, but facing issue in skype and webchat (Haven't tested in Facebook).
Code
` LuisApplication luisApplication = new LuisApplication(
_configuration["luisAppId"],
_configuration["LuisAPIKey"],
"https://" + _configuration["LuisAPIHostName"]); ;
var recognizer = new LuisRecognizer(luisApplication);
// Issue is with this line.
RecognizerResult recognizerResult = await recognizer.RecognizeAsync(turnContext,
cancellationToken);`
Error Message
Operation returned an invalid status code 'Gone'
Exception
Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models.APIErrorException: Operation returned an invalid status code 'Gone' at Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Prediction.ResolveWithHttpMessagesAsync(String appId, String query, Nullable1 timezoneOffset, Nullable1 verbose, Nullable1 staging, Nullable1 spellCheck, String bingSpellCheckSubscriptionKey, Nullable1 log, Dictionary2 customHeaders, CancellationToken cancellationToken) at Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.PredictionExtensions.ResolveAsync(IPrediction operations, String appId, String query, Nullable1 timezoneOffset, Nullable1 verbose, Nullable1 staging, Nullable1 spellCheck, String bingSpellCheckSubscriptionKey, Nullable`1 log, CancellationToken cancellationToken) at Microsoft.Bot.Builder.AI.Luis.LuisRecognizer.RecognizeInternalAsync(ITurnContext turnContext, CancellationToken cancellationToken) at Microsoft.Bot.Builder.AI.Luis.LuisRecognizer.RecognizeAsync(ITurnContext turnContext, CancellationToken cancellationToken) at Airlines.Dialogs.AirlinesRootDialog.GetLuisConfigNameAsync(ITurnContext turnContext, CancellationToken cancellationToken) in C:\XXXX\Bots\XXXXXX-src\Dialogs\XXXRootDialog.cs:line 179 at Airlines.Dialogs.AirlinesRootDialog.OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken) in C:\XXXX\Bots\XXXXXX-src\Dialogs\XXXRootDialog.cs:line:line 69 at Microsoft.Bot.Builder.MiddlewareSet.ReceiveActivityWithStatusAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken) at Microsoft.Bot.Builder.BotAdapter.RunPipelineAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken)
Dileep, one reason this error happens is if the LUIS model hasn't yet been published yet. The 'Gone' is some kind of an indication that the resource being called is not present.
@mprabhu11, I have published LUIS app. if it's not published means how is it working in bot emulator or accessing through API? It has to show same issue in debugging too But that's not the case. Facing issue once I deployed it.
Ok, hopefully you've made approp changes to the endpoints in your code reflecting the deployed one.
Try a raw query from your browser to match what your code is attempting to call... Something like this:
https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/01234567-89ab-cdef-0123-4567890abdef?subscription-key=fedcba0987654321fedcba0987654321&q='hello'
It should give a legit looking result like:
{
"query": "'hello'",
"topScoringIntent": {
"intent": "Greeting",
"score": 0.4556272
},
"entities": []
}
Hi @dileepkantapop!
'Gone' Errors occur in one of two situations: either as @mprabhu11 mentioned where a LUIS resource has not been published, or 2) something is configured incorrectly in bot file. Given that you say your error is occurring after deploying your bot, please confirm that your have an appropriate 'production' endpoint in your .bot file.
@jwiley84 I am trying to access LUIS appid, apikey and hostname from appsettings.json. Which is causing the error after deploying.
I see! Let me see if I can repro this for you.
what does this resolve to:
"https://" + _configuration["LuisAPIHostName"]);
To get a LuisApplication, you only need to pass in the AppId, the AuthoringKey and the Endpoint. The Endpoint is simply
"https://" + YOURLUISAPPREGION + "api.cognitive.microsoft.com"
For example, my Luis app is in WestUS, so my endpoint is https://westus.api.cognitive.microsoft.com
@jwiley84 LuisAPIHostName has westus.api.cognitive.microsoft.com, at last, the URL will be same as which you mentioned https://westus.api.cognitive.microsoft.com.
What is returned when you use a debugger on this:
var recognizer = new LuisRecognizer(luisApplication);
In debugging it's working fine when I keep ngrok from my local machine. recognizer returned the variable it's created "Microsoft.Bot.Builder.AI.Luis.LuisRecognizer".
and just to confirm, the following does not return null:
LuisApplication luisApplication = new LuisApplication(
_configuration["luisAppId"],
_configuration["LuisAPIKey"],
"https://" + _configuration["LuisAPIHostName"]);
Hi @dileepkantapop Please let me know what the luisApplication is returning, or let me know if you are no longer having this issue.
@jwiley84 Sorry for the late, luisApplication is not returning null, It's creating the variable.
AFAIK, the only thing that can cause a 'Gone' error is a malformed request to the LUIS service. LUISRecognizer has an option where you can pass in a string of the LUIS endpoint. What happens if you pass it in manually?
var luisService = new LuisRecognizer("https://<YOURLUISREGION>.api.cognitive.microsoft.com/luis/v2.0/apps/<YOURLUISAPPID>?subscription-key=<YOURLUISKEY>");
@jwiley84 If I pass the values manually, I am able to get the response.
Ok, good. Sorta. That means it's not a problem with your LUIS. Can you post an image of your debugger running on the luisApplication, with it expanded? Like this:

Somehow, your keys aren't coming through your appsettings.json like they should. luisApplication is just a form of container for essentially what's in the LUIS endpoint string. In fact, if you pass in a string, the constructor just goes back and makes a luisApplication out of it.
Hi @dileepkantapop
Just checking if you still have this issue.
Closing issue. If this issue persists or begins occurring again, please reopen issue.
I faced similar issue, issue with Luis configuration, follow below steps. MANAGE>Application Information>Make endpoint public Check this option and make your endpoint public.