botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

[LUIS] Errorcode 414 (Request URL is too long)

Open kevinport opened this issue 9 years ago • 5 comments

Our Bot throws the following Error while sending an Message with length bigger than 500 characters.

Sorry, my bot code is having an issue

The code is in the LuiseService.cs file:

async Task<LuisResult> ILuisService.QueryAsync(Uri uri, CancellationToken token)
        {
            string json;
            using (var client = new HttpClient())
            using (var response = await client.GetAsync(uri, HttpCompletionOption.ResponseContentRead, token))
            {
                response.EnsureSuccessStatusCode();
                json = await response.Content.ReadAsStringAsync();
            }
        }

The bot message is transfered by an url parameter, which is the reason for the error.......

Is there a way to transfer the message not as an url parameter or change the error text to signal the user that the message is too long?

kevinport avatar Jan 19 '17 08:01 kevinport

You could catch the exception from LUIS and translate it to a message for the user - for example, you might override the MessageReceived method of LuisDialog, and if it throws that exception, swallow it and post a message back to the user.

willportnoy avatar Jan 19 '17 22:01 willportnoy

We are using the structure of the Alarmbot Sample. Few weeks ago the alarm bot uses the LuisDialog but now the Sample uses the DispatchDialog class, but there is no MessageReceived Method to override...

But this doesn't solve the problem, that the messages are restricted to about 500 characters...

Moreover i think this error should be handled by the framework or must be communicated to the framework users (developer).

kevinport avatar Jan 21 '17 13:01 kevinport

Bump. I'm getting the same issue with the node.js sdk.

In this case the string body passed to JSON.parse() is an empty string due to the issue mentioned above.

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Request._callback (/Users/tarikourchane/Development/JSDev/gameon-bot/node_modules/botbuilder/lib/dialogs/LuisRecognizer.js:80:39)
    at Request.init.self.callback (/Users/tarikourchane/Development/JSDev/gameon-bot/node_modules/request/request.js:188:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:194:7)
    at Request.<anonymous> (/Users/tarikourchane/Development/JSDev/gameon-bot/node_modules/request/request.js:1171:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:191:7)
    at IncomingMessage.<anonymous> (/Users/tarikourchane/Development/JSDev/gameon-bot/node_modules/request/request.js:1091:12)
    at Object.onceWrapper (events.js:293:19)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:188:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickDomainCallback (internal/process/next_tick.js:128:9)

xitij avatar May 19 '17 18:05 xitij

@xitij This issue is specific to the .NET SDK, please open a new issue so the Node SDK team can track it. Thx

nwhitmont avatar May 24 '17 23:05 nwhitmont

@kevinport Are you still experiencing the issue after upgrading to BotBuilder 3.8.1?

nwhitmont avatar May 24 '17 23:05 nwhitmont