同時起10個線程:
創建的function名稱爲jerryfuncv3_{uuid}, uuid爲從1到100之間的隨機整數:
測試結果,10次有8次全是400 bad request:
比如這次jerryfuncv3_70就應該是創建失敗了:
然而Azure上卻能看到這10個成功創建好的function:
所以從結果上看Azure function創建成功了,但不知道Azure host runtime爲什麼會返回400 bad request…
有時候在Azure portal上手動創建function都會400 error?
{"properties":{"files":{"index.js":"module.exports = async function (context, req) {\r\n context.log('JavaScript HTTP trigger function processed a request.');\r\n\r\n if (req.query.name || (req.body && req.body.name)) {\r\n context.res = {\r\n // status: 200, /* Defaults to 200 */\r\n body: \"Hello \" + (req.query.name || req.body.name)\r\n };\r\n }\r\n else {\r\n context.res = {\r\n status: 400,\r\n body: \"Please pass a name on the query string or in the request body\"\r\n };\r\n }\r\n};"},"test_data":"{\r\n \"name\": \"Azure\"\r\n}","config":{"bindings":[{"authLevel":"anonymous","type":"httpTrigger","direction":"in","name":"req","methods":["get","post"]},{"type":"http","direction":"out","name":"res"}],"disabled":false}}}
在Azure API console裏調用API也會報錯:
錯誤消息詳情:
{
"Code": "BadRequest",
"Message": "Encountered an error (InternalServerError) from host runtime.",
"Target": null,
"Details": [
{
"Message": "Encountered an error (InternalServerError) from host runtime."
},
{
"Code": "BadRequest"
},
{
"ErrorEntity": {
"Code": "BadRequest",
"Message": "Encountered an error (InternalServerError) from host runtime."
}
}
],
"Innererror": null
}
https://github.com/microsoft/vscode-azurefunctions/issues/1838
要獲取更多Jerry的原創文章,請關注公衆號"汪子熙":