我有一个关于消费计划的简单 python Azure 函数。
它在本地运行良好。代码如下。
import logging
import azure.functions as func
def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
name = req.params.get('name')
if not name:
try:
req_body = req.get_json()
except ValueError:
pass
else:
name = req_body.get('name')
if name:
return func.HttpResponse(f"Hello, {name}. This HTTP triggered function executed successfully.")
else:
return func.HttpResponse(
"This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.",
status_code=200
)
在部署到服务器时,所有代码和必要的包也得到了很好的部署。
然而,http 触发器根本没有同步。
错误是。
11:25:36 pm MyAzureFunctionConsumptionPlan04: Uploading built content /home/site/artifacts/functionappartifact.squashfs for linux consumption function app...
11:25:36 pm MyAzureFunctionConsumptionPlan04: Resetting all workers for MyAzureFunctionConsumptionPlan04.azurewebsites.net
11:25:37 pm MyAzureFunctionConsumptionPlan04: Deployment successful.
11:25:52 pm MyAzureFunctionConsumptionPlan04: Syncing triggers...
11:25:54 pm MyAzureFunctionConsumptionPlan04: Querying triggers...
11:25:57 pm MyAzureFunctionConsumptionPlan04: No HTTP triggers found.
或者它只是创建一个名为 WarmUp 的触发器,我的代码中没有使用它。
11:16:57 pm MyAzureFunctionConsumptionPlan01: Querying triggers...
11:16:59 pm MyAzureFunctionConsumptionPlan01: HTTP Trigger Urls:
WarmUp: https://MyAzureFunctionConsumptionPlan01.azurewebsites.net/api/%7Bx:regex(^(warmup|csharphttpwarmup)$)%7D
我正在使用的触发器,即。 myhttptrigger 根本没有同步。可能有什么问题。
我已经尝试了微软支持文章中的所有步骤,在这里:https://docs.microsoft.com/en-us/answers/questions/249753/azure-functions-are-not-visible-in-the-function-li.html 包括
重新启动 Azure 功能,
重新创建Azure 函数以及
在 ssh 上手动验证文件
查询kudu控制台,
点击管理网址(通过 REST API)。
他们似乎还没有一个积极的解决方案!