在Microsoft 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

