microsoft / microsoft/BotFramework-DirectLineJS

Attachments with incorrect base64 contentUrl in sendActivity fails silently

未关闭
#159 8 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@ckkashyap 已经在做这个了。

开始于 2019年2月6日。

主要语言
TypeScript
星标
199
派生
133
PR 合并指标
30 天内没有已合并 PR

描述

Versions

What package version of the SDK are you using: 4.0.8 (botbuilder, botbuilder-dialogs)
What nodejs version are you using: v.8.12.0
What browser version are you using: Chrome v69
What os are you using: Windows 10

Describe the bug

When trying to create an attachment that is intentionally corrupt (via an incorrect base64 url), the bot fails silently without throwing an error.

To Reproduce

  1. Create bot with command to trigger send activity with an attachment with the following code:
  try {
    console.log('Start');

    await context.sendActivity({
      type: 'message',
      attachments: [{
        contentType: 'text/plain',
        contentUrl: 'data:image/png;base64,abc\nabc',
        name: 'dot.png'
      }]
    });

    console.log('Succeeded');
  } catch (err) {
    console.log(err);
    throw err;
  }

And on the BotFrameworkAdapter instance, register an onTurnError handler like so:

adapter.onTurnError = async (context, error) => {
  console.log(error);
  await context.sendActivity(`Sorry, ran into an error!\n  ${ error.message }`);
}
  1. Run bot, send command utterance to send activity
  2. Sending the command failed
    Note that there is no error in the console, and the line console.log("Succeeded"); is never reached. Similarly, onTurnError is never triggered.

The message fails silently, and after timing out, the Web Chat instance logs a 502 Bad Gateway error.

Sending other messages pass through successfully.

Expected behavior

Since the contentUrl is invalid, the bot should try and catch an error when this command is initiated.

[bug]

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。