Application crashes when refresh token returns an error
@compulim đang làm issue này rồi.
Từ ngày 24/7/2024.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
If tokens/refresh returns an error, the application crashes, and there is no way to catch and handle it properly.
Reproduced by:
import { DirectLine, ConnectionStatus } from 'botframework-directlinejs';
import WebSocket, { WebSocketServer } from 'ws';
import nock from 'nock';
import xhr2 from 'xhr2';
global.XMLHttpRequest = xhr2;
global.WebSocket = WebSocket;
const wss = new WebSocketServer({ port: 2222 });
wss.on('connection', function connection(ws) {
ws.on('error', console.error);
ws.send('{"activities": []}');
});
nock('https://directline.botframework.com')
.persist()
.post(uri => uri.startsWith('/v3/directline/conversations'))
.reply(
200,
JSON.stringify({
conversationId: '123',
token: '456',
streamUrl: 'ws://localhost:2222'
})
)
.post(uri => uri.includes('/refresh'))
.reply(403);
const directLine = new DirectLine({ token: '456' });
directLine.activity$
.subscribe(
(activity) => console.log('Activity received: ', activity),
(err) => console.error('**1 Error: ', err)
);
directLine.connectionStatus$
.subscribe(
(connectionStatus) => console.log('DirectLine status: ' + ConnectionStatus[connectionStatus]),
(err) => console.error('**2 Error: ', err)
);
process.on('uncaughtException', (err) => {
console.error('**3 Error: ', err);
process.exit(1);
});
If you don't want to wait 15 minutes, reduce the hardcoded value of lifetimeRefreshToken :)
Output:
DirectLine status: Connecting
DirectLine status: Online
DirectLine status: ExpiredToken
DirectLine status: ExpiredToken
**3 Error: [AjaxError: ajax error 403] {
xhr: <ref *1> XMLHttpRequest {
onloadstart: null,
onprogress: null,
onabort: null,
onerror: null,
onload: null,
ontimeout: [Function: xhrTimeout] {
request: [Object],
subscriber: [AjaxSubscriber],
progressSubscriber: undefined
},
onloadend: null,
_listeners: {},
onreadystatechange: [Function: xhrReadyStateChange] {
subscriber: [AjaxSubscriber],
progressSubscriber: undefined,
request: [Object]
},
_anonymous: undefined,
readyState: 4,
response: null,
responseText: null,
responseType: 'json',
responseURL: 'https://directline.botframework.com/v3/directline/tokens/refresh',
status: 403,
statusText: 'Forbidden',
...
- Ngôn ngữ chính
- TypeScript
- Star
- 199
- Fork
- 133
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/BotFramework-DirectLineJS
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
microsoft/BotFramework-DirectLineJS#432 · 1 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
microsoft/BotFramework-DirectLineJS#424 · 3 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
microsoft/BotFramework-DirectLineJS#418 · 7 bình luận · 7 reaction ·
Tất cả issue của microsoft/BotFramework-DirectLineJS
Issue tương tự
-
Type/Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
OpenNSW/nsw-srilanka#497 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
0xMiden/bridge-portal#132 ·
-
react-doctor severity:warning tech-debt
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
digidem/comapeo-cloud-app#403 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100