node.js - 根本不执行简单的 Azure retrieveEntity
问题描述
这个非常简单的事情对我不起作用,即使我实际上已经从这里复制+粘贴了示例代码:
https://github.com/Azure/azure-storage-node
似乎 tableService.retrieveEntity 根本不会触发?context.log 不打印任何内容。我得到一个没有正文的状态 200,但这是因为这是 Azure 的默认设置。
如果我编写查询并同时使用 queryEntities 方法,也会出现同样的问题。
为简单起见,我在 Azure 门户中编写了这些内容。
这是我的代码:
var azure = require('azure-storage');
module.exports = async function (context, req) {
var tableService = azure.createTableService('myTable', 'GoYVMvN+SXRJhzVERIYWFu6k0/DkZINIerS+YpwmQVy3ppPFJ+8bTavfisHJvsNbo5hjgpw40bWv8XXXXXXXXX==');
tableService.retrieveEntity('myList', 'MyPartitionKey', '1', function(error, result, response) {
context.log("retrieving...")
if(!error){
context.res = {
status: 200,
body: "The entity was retrieved"
}
} else {
context.res = {
status: 500,
body: "The entity was not retrieved"
}
}
});
};
解决方案
推荐阅读
- javascript - 使用 Jest 进行测试 - 无法识别 HTML DOM 函数
- flutter - 错误:参数类型 int 不能分配给参数类型字符串
- android - Android Studio NoClassDefFoundError:KitKat 上的 android.support.v4.content.LocalBroadcastManager
- vba - 当前打开的 Access 应用程序集合
- javascript - 如何将 ID 属性添加到 asp.net MVC 链接元素
- java - @RepositoryRestResource 中的自定义实现
- vba - 从电子邮件中检索发件人姓名
- templates - 如何在 Strapi 中使用 EJS
- linked-data - LDFlex 过滤器按类型
- javascript - Moving an image Javascript