即使我实际上是从此处复制并粘贴示例代码的,但这种非常简单的方法对我也不起作用:
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"
}
}
});
};