使用Node和JavaScript构建机器人并连接到Azure Blob存储:
const { BlobStorage } = require('botbuilder-azure');
var optionsBlob = {
containerName: 'messages',
storageAccountOrConnectionString: <secret>
};
从npm的Basic Usage中获取确切的代码,然后在我运行node start
时收到此错误
[onTurnError] unhandled error: TypeError: this.storage.read is not a function
我的依赖项都已安装:
"dependencies": {
"botbuilder": "~4.6.2",
"botbuilder-azure": "^4.6.2",
"dotenv": "^8.2.0",
"restify": "~8.4.0"
},
答案 0 :(得分:0)
找到它了,我没有将存储实例传递给状态管理器。
const { BlobStorage } = require('botbuilder-azure');
var options = {
containerName: 'messages',
storageAccountOrConnectionString: process.env.STORAGE_CONNECTION_STRING,
};
const blobStorage = new BlobStorage(options);
// I was not passing the correct object to the state manager
// Make sure you pass it here
const userState = new UserState(blobStorage);
const conversationState = new ConversationState(blobStorage);