Search code examples
azure-function-appazure-http-trigger

Function Running in local and not when deployed to Azure


I have a http trigger function, when I sent a message to the url, it logs data on the queuestorage as required;

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

However when I do the same in azure on the function url

https://yyyyy.azurewebsites.net/api/xxxx?message=89000 nothing is logged.

How can I have this resolved?

Another question; The underlying code is

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
    )

It is expected to receive the following payload

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

when I do http://localhost:7071/api/xxxx?message=89000, it logs the queue storage just fine but not when this payload is delivered. How can I have this configured?


Solution

  • Azure function app don't get environment variable from local.settings.json on portal.

    You need to add below setting:

    enter image description here

    To

    enter image description here

    And in order to prevent the inability to save messages due to certain settings of the queue, you can try to create a new queue to avoid this situation.