对于我的typescript函数,我尝试访问tablestorage。(consumption函数,Linux,节点运行时)
import { AzureFunction, Context, HttpRequest } from "@azure/functions"
const httpTrigger: AzureFunction = async function (context: Context, req: HttpRequest): Promise<void> {
context.log('HTTP trigger function processed a request.');
const name = (req.query.name || (req.body && req.body.name));
var responseMessage = name
? "Hello, " + name + ". This HTTP triggered function executed successfully."
: "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.";
context.bindings.tableBinding = [];
context.bindings.tableBinding.push({
PartitionKey: "Test",
RowKey: "iii",
Name: "Name "
});
context.res = {
// status: 200, /* Defaults to 200 */
body: responseMessage
};
};
export default httpTrigger;
function.json中的绑定
{
"tableName": "GameState",
"connection": "",
"name": "tableBinding",
"type": "table",
"direction": "out"
},
然而,作为响应,我得到一个内部服务器错误500.
有着令人困惑的错误
Exception while executing function: Functions.writeToTable '' is not a valid value for a partition key or row key.
关于如何进一步fiz/调试这个问题有什么想法吗?
1条答案
按热度按时间rhfm7lfc1#
如果您使用的是3.0版,这可能导致表存储绑定出错。请尝试将版本更改为2.0。
2.0版中的扩展包示例
参考文献: