You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you send an InvokeActivity to postActivity via dljs, a success will return an id with the activity ID. However, an Invoke can return other status codes for error/failure cases. When this happens, postActivity still calls the "success" trigger but with an id of 'retry'.
Repro code:
directLine.postActivity({
type: 'invoke',
name: 'good'
}).subscribe(
id => {
console.log("Posted activity, assigned ID ", id); // this is called with a real id
},
error => {
console.log("Error posting activity", error);
}
);
directLine.postActivity({
type: 'invoke',
name: 'bad'
}).subscribe(
id => {
console.log("Posted activity, assigned ID ", id); // this is called with an id of 'retry'
},
error => {
console.log("Error posting activity", error);
}
);
For the boy, just handle invokes and return an InvokeResponse of 409 or whatnot in that bad case, and an InvokeResponse of 200 in the good case:
Here is some C# code to do this:
protected override async Task OnInvokeActivityAsync(ITurnContext turnContext, CancellationToken cancellationToken)
{
await turnContext.SendActivityAsync("Got an invoke: " + turnContext.Activity.Name);
if (turnContext.Activity.Name == "good")
{
await turnContext.SendActivityAsync(
new Activity
{
Type = ActivityTypesEx.InvokeResponse,
Value = new InvokeResponse
{
Status = 200
},
}, cancellationToken).ConfigureAwait(false);
}
else if (turnContext.Activity.Name == "bad")
{
await turnContext.SendActivityAsync(
new Activity
{
Type = ActivityTypesEx.InvokeResponse,
Value = new InvokeResponse
{
Status = 409
},
}, cancellationToken).ConfigureAwait(false);
}
else
{
await base.OnInvokeActivityAsync(turnContext, cancellationToken);
}
}
Expected behavior:
(1) At least the error case should be called.
(2) It'd be nice to get the actual result code, or the 502 saying message wasn't processed properly by the bot if that's all DirectLine returns
The text was updated successfully, but these errors were encountered:
Any update on this? The issue is open since January, no proper debugging is possible if the error is swallowed. Also because of how this lib is build its impossible to set a breakpoint in code because it is dynamically compiled during runtime....
Any news? Two years later and still have this error.
Deployed the bot with latest BotFrameworkComposer and updated this package.
By the way, when using the emulator the bot responds correctly
If you send an InvokeActivity to postActivity via dljs, a success will return an id with the activity ID. However, an Invoke can return other status codes for error/failure cases. When this happens, postActivity still calls the "success" trigger but with an id of 'retry'.
Repro code:
directLine.postActivity({
type: 'invoke',
name: 'good'
}).subscribe(
id => {
console.log("Posted activity, assigned ID ", id); // this is called with a real id
},
error => {
console.log("Error posting activity", error);
}
);
directLine.postActivity({
type: 'invoke',
name: 'bad'
}).subscribe(
id => {
console.log("Posted activity, assigned ID ", id); // this is called with an id of 'retry'
},
error => {
console.log("Error posting activity", error);
}
);
For the boy, just handle invokes and return an InvokeResponse of 409 or whatnot in that bad case, and an InvokeResponse of 200 in the good case:
Here is some C# code to do this:
protected override async Task OnInvokeActivityAsync(ITurnContext turnContext, CancellationToken cancellationToken)
{
await turnContext.SendActivityAsync("Got an invoke: " + turnContext.Activity.Name);
if (turnContext.Activity.Name == "good")
{
await turnContext.SendActivityAsync(
new Activity
{
Type = ActivityTypesEx.InvokeResponse,
Value = new InvokeResponse
{
Status = 200
},
}, cancellationToken).ConfigureAwait(false);
}
else if (turnContext.Activity.Name == "bad")
{
await turnContext.SendActivityAsync(
new Activity
{
Type = ActivityTypesEx.InvokeResponse,
Value = new InvokeResponse
{
Status = 409
},
}, cancellationToken).ConfigureAwait(false);
}
else
{
await base.OnInvokeActivityAsync(turnContext, cancellationToken);
}
}
Expected behavior:
(1) At least the error case should be called.
(2) It'd be nice to get the actual result code, or the 502 saying message wasn't processed properly by the bot if that's all DirectLine returns
The text was updated successfully, but these errors were encountered: