You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Microsoft Bot Framework中发送查询结果时遇类型错误求助

解决Bot Framework中session.send()发送数字报错的问题

Hey there! Let's work through this error you're hitting. The root of the problem is that session.send() in the Microsoft Bot Framework expects either a string or a properly structured message object as input—but right now, you're passing a raw numeric value directly.

When you try to send column.value (which is a number like 763), the framework attempts to add a type property to the value internally. But since numbers are primitive values in JavaScript, you can't attach new properties to them—that's exactly what's causing the error message: cannot create property 'type' on number.

修复方案

You just need to convert the number to a string before passing it to session.send(). Here's how to adjust your code:

request.on('row', function(columns) { 
  columns.forEach(function(column) { 
    // Convert the numeric value to a string
    session.send(column.value.toString()); 
    next(); 
  }); 
});

Another clean option is to use a template string to wrap the number:

session.send(`${column.value}`);

Either method will turn the number into a string, which the Bot Framework can process without trying to modify the primitive value. This should get rid of that error and let your message send correctly!

内容的提问来源于stack exchange,提问作者Christian Abata

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 03:42:00