dialogflow-nodejs-client icon indicating copy to clipboard operation
dialogflow-nodejs-client copied to clipboard

ServerError: Wrong response status code.

Open prakharter opened this issue 7 years ago • 11 comments

Hi ,

I have created several Intents but for some of them when i am using the NodeJS SDK the response is coming on error inside the below code with the error as ServerError: Wrong response status code.

request.on('error', function(error) { console.log(error); }); This works find from the api.ai test console. Please advise

prakharter avatar Apr 10 '17 13:04 prakharter

Any suggestions please ?

prakharter avatar Apr 21 '17 07:04 prakharter

I got this issue too.

jacksun101 avatar Apr 25 '17 09:04 jacksun101

Same here

robwhelan avatar May 10 '17 02:05 robwhelan

I encountered this error while forming my apiaiRequest, and I was so convinced this wasn't it at first, but it seems I was using the entire 'message' node instead of 'message.text', resulting in an object being passed down with stuff like $mid and such in it.

Haven't encountered the error anymore since switching to just text being passed into the apiaiRequest as the first argument. Though, in other people's cases, it could be something else.

codinsonn avatar May 29 '17 14:05 codinsonn

I am trying to get Alexa to use AWS Lambda which is set up using AlexaApiAiBridge and I'm also having the same issue. I have narrowed it down to the request's sessionId. If my sessionId is sent through as:

"sessionId": "amzn1.echo-api.session.[unique-value-here]",

it works fine, but if I use a real one:

"sessionId": "SessionId.fe89ec31-638c-45f4-80b9-e71456539a32",

I get the response error:

ServerError: Wrong response status code.

I'm stuck on this so any help would be greatly appreciated.

juliusspencer avatar Jun 12 '17 01:06 juliusspencer

@juliusspencer https://docs.api.ai/docs/query#query-parameters-and-json-fields

A string token up to 36 symbols long, used to identify the client and to manage session parameters (including contexts) per client.

sstepashka avatar Jun 12 '17 01:06 sstepashka

@sstepashka Thanks for the quick response. Does this mean API.AI won't support Alexa requests? Maybe there needs to be some session management in AlexaApiAiBridge.

I'm new to Alexa (I've been using a Google Home so far).

juliusspencer avatar Jun 12 '17 01:06 juliusspencer

@juliusspencer Please, red this line https://github.com/Gnzlt/AlexaApiAiBridge/blob/master/index.js#L104 The developer just cutoff part of ID, if your replace this code for the following:

alexaSessionId = sessionId.split('SessionId.').pop();

We don't support 'AlexaApiAiBridge'. It is third party.

sstepashka avatar Jun 12 '17 02:06 sstepashka

Oh right, that makes a lot of sense, I will try this.

Thank you so much! Hopefully someone will find this useful. I will try create a PR.

juliusspencer avatar Jun 12 '17 04:06 juliusspencer

I've made a pull request on their repo that uses partially this solution and partially a different one to make up for the two different session id formats that Amazon uses :)

patcat avatar Jul 09 '17 09:07 patcat

Anyone still has that error? Been using this SDK for 8 months now without any problems and now suddenly it doesn't work...

I have the simplest test every and still receives the same error. ServerError: Wrong response status code.

apiaiService
    .textRequest('test', { sessionId: shortid.generate() })
    .on('response', console.log)
    .on('error', err => {
        console.log("err", err)
    })
    .end()

Thank you for any help!

thierryskoda avatar Sep 11 '17 18:09 thierryskoda