Giter Site home page Giter Site logo

Comments (16)

billba avatar billba commented on July 19, 2024

Please upgrade to the latest release; Observable.throw was not included but now it is.

This may solve one problem and reveal another, but let's take this one step at a time.

from botframework-directlinejs.

zhou-xinghai avatar zhou-xinghai commented on July 19, 2024

okay, thanks you, have upgraded to the latest one.

from botframework-directlinejs.

zhou-xinghai avatar zhou-xinghai commented on July 19, 2024

hi, sometimes when i call postActivity, it returns with the id "retry". It seems a problem of directline that when I send msg to directline it returns retry rather than consiation|id like "BwWr2WLPs6a2LaalX4abzC|0000001". Do you have any idea on how it happens? thanks
ps: I use websocket, is it related to websocket close and reopen? I found this log.

from botframework-directlinejs.

billba avatar billba commented on July 19, 2024

That means the call failed but could be retried. I admit this is a poor API choice, will look at cleaning up.

webSocket is used for receiving messages, not sending.

from botframework-directlinejs.

zhou-xinghai avatar zhou-xinghai commented on July 19, 2024

Is this error return by directline API? Is there way to start a new conversation under this condition or how can I handle this error with BotFramework-DirectLineJS ? Any suggestion is appreciated.

from botframework-directlinejs.

billba avatar billba commented on July 19, 2024

This return value means the attempt to post the activity failed, possibly due to timeout or other network conditions. The conversation is still ongoing and doesn't need to be restarted.

from botframework-directlinejs.

zhou-xinghai avatar zhou-xinghai commented on July 19, 2024

Yes, but it seems not a network problem. As long as i restart the service which will start a new conversition then it goes fine again. I guess i need to log out the error msg to find the real cause.

from botframework-directlinejs.

billba avatar billba commented on July 19, 2024

My mistake, I responded from memory without looking at the code.

When postActivity returns "retry" it means the access token has expired. If you subscribe to connectionStatus$ as described in the README you can see it changed to ExpiredToken.

A token is a short-lived credential you get by calling the tokens/generate Direct Line endpoint. The only reason to use a token is when you don't want to expose a secret to the outside world, usually in a web page. This isn't a problem on a server. On a server, you probably shouldn't be using tokens. You can just use the Direct Line secret.

Even if you have a reason to use a token on the server, DirectLineJS renews the token every 15 minutes by calling the /tokens/refresh DirectLine endpoint. So if you are getting this error:

  • You are having an extended connectivity problem (one that lasts more than 15 minute), or
  • You are creating DirectLineJS by passing the token using the secret parameter, which will not trigger the token renewal process

If you are in fact not using tokens, then there is probably a bug in my code.

from botframework-directlinejs.

zhou-xinghai avatar zhou-xinghai commented on July 19, 2024

Thanks for your clue. I use secret to create the directline instance. The problem occurs when it runs more than 15 hours last time. I added some log in your function catchPostError and catchExpiredToken to track what error may cause the problem. It has run more than 7 hours normally. I'll let you know if I reproduce it.

from botframework-directlinejs.

billba avatar billba commented on July 19, 2024

That sounds frustrating. I'm out of ideas for now. This could be a bug in the library (e.g. a memory leak, since it only happens after many hours) or a problem with Direct Line itself. I look forward to hearing what you learn.

from botframework-directlinejs.

billba avatar billba commented on July 19, 2024

update: I was sort of right the first time. That error can mean token issues OR a variety of other errors, including timeout and connectivity errors.

from botframework-directlinejs.

zhou-xinghai avatar zhou-xinghai commented on July 19, 2024

I haven't reproduce the issue yet. It goes fine in these two days, will keep you update.

from botframework-directlinejs.

zhou-xinghai avatar zhou-xinghai commented on July 19, 2024

Hi billba,
I reproduce the issue. It happed when the websocket lost connection, then you will reconnect the websocket immediately. Then after a while when I post msg to directline, it return 403 and the msg "error": {\r\n "code": "TokenExpired",\r\n "message": "Token has expired"\r\n }\r". Then all the subsequent calls will return the same.
I guess the problem is caused by function reconnectToConversation(). You reset the token here which make my secret don't work any more. I read the doc of directline and didn't find any infomation on that. So is it necessary to set that value to replace the secrect?

from botframework-directlinejs.

billba avatar billba commented on July 19, 2024

Ah! You found a bug. We should not be setting this.token unless this.secret is undefined. I will fix in the morning. Very sorry for the trouble, thanks for investigating.

from botframework-directlinejs.

billba avatar billba commented on July 19, 2024

Please update to the latest version to get the fix. Thanks again for tracking this down.

from botframework-directlinejs.

zhou-xinghai avatar zhou-xinghai commented on July 19, 2024

Okay, thank you .

from botframework-directlinejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.