Line 118 returns a Promise, but line 125 returns a string or undefined:
|
getSignInUrl: |
|
cardAction.type === 'signin' |
|
? () => { |
|
const { value } = cardAction; |
|
|
|
if (directLine.getSessionId) { |
|
// TODO: [P3] We should change this one to async/await. |
|
// This is the first place in this project to use async. |
|
// Thus, we need to add @babel/plugin-transform-runtime and @babel/runtime. |
|
|
|
return observableToPromise(directLine.getSessionId()).then( |
|
sessionId => `${value}${encodeURIComponent(`&code_challenge=${sessionId}`)}` |
|
); |
|
} |
|
|
|
console.warn('botframework-webchat: OAuth is not supported on this Direct Line adapter.'); |
|
|
|
return value; |
This causes an exception in createDefaultCardActionMiddleware() where it expects getSignInUrl to return a Promise:
|
const popup = window.open(); |
|
|
|
getSignInUrl().then(url => { |
|
popup.location.href = url; |
|
}); |
This issue was discovered while trying to use OAuth + Streaming (specifically DL ASE), though directLine.getSessionId may be falsey, the return values should have the same type.
Possible fix:
One solution is to return Promise.resolve(value); instead of return value;

FYI @jiruss, @DDEfromOR, @ckkashyap, @anusharavindrar
Line 118 returns a Promise, but line 125 returns a string or undefined:
BotFramework-WebChat/packages/component/src/Composer.js
Lines 108 to 125 in 906de77
This causes an exception in
createDefaultCardActionMiddleware()where it expects getSignInUrl to return a Promise:BotFramework-WebChat/packages/component/src/Middleware/CardAction/createCoreMiddleware.js
Lines 75 to 79 in b47cdac
This issue was discovered while trying to use OAuth + Streaming (specifically DL ASE), though
directLine.getSessionIdmay be falsey, the return values should have the same type.Possible fix:
One solution is to
return Promise.resolve(value);instead ofreturn value;FYI @jiruss, @DDEfromOR, @ckkashyap, @anusharavindrar