函数 运行 在本地而不是在部署到 Azure 时

Function Running in local and not when deployed to Azure

我有一个 http 触发器功能,当我向 url 发送消息时,它会根据需要在队列存储中记录数据;

http://localhost:7071/api/xxxx?message=89000

然而,当我在 azure 中对函数执行相同操作时 url

https://yyyyy.azurewebsites.net/api/xxxx?message=89000 未记录任何内容。

我该如何解决这个问题?

另一个问题; 底层代码为

import logging
import azure.functions as func
def main(req: func.HttpRequest,msg: func.Out[str]) -> func.HttpResponse:
    logging.info('Python HTTP trigger function processed a request.')
    input_msg = req.params.get('message')
    logging.info(input_msg)
    msg.set(input_msg)
    return func.HttpResponse(
            "This is a test.",
            status_code=200
    )

预计会收到以下payload

{
    "layerId":0,
    "serviceName": "myService",
    "changeType": "FeaturesCreated",
    "orgId": "myorgId"
    "changesUrl": "https://olserver/services/myService/FeatureService/extractChanges?serverGens=[1122, 1124]"
}

当我执行 http://localhost:7071/api/xxxx?message=89000 时,它会很好地记录队列存储,但不会在交付此有效负载时记录。我该如何配置?

Azure 函数应用无法从门户上的 local.settings.json 获取环境变量。

您需要添加以下设置:

并且为了防止由于队列的某些设置导致无法保存消息,您可以尝试新建一个队列来避免这种情况。