7

I have a simple python Azure function on consumption plan.

It runs well on local very well. Code below.

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
    )

when deploying to Server, all the code and necessary packages get deployed well as well.

However, the http trigger's are not at all getting synchronized.

the error is either.

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.

or it just creates one trigger called WarmUp, which is not used in my code.

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
  

The trigger I'm using, viz. myhttptrigger does not get synchronized at all. What could possibly be wrong.

I've tried all the steps from microsoft support article, over here : https://learn.microsoft.com/en-us/answers/questions/249753/azure-functions-are-not-visible-in-the-function-li.html including

restarting the Azure function,

recreating the Azure function from scratch and also

verifying the files manually on ssh

querying the kudu console,

hitting the management url(via REST API).

none of them seem to have a positive solution as yet!

2
  • 1
    any solving? Thkx Commented Oct 20, 2021 at 11:41
  • I'd like to confirm that this issue has been resolved and hence answering this question Commented Jul 11, 2022 at 17:16

3 Answers 3

2

I just had this same issue, and after 3-ish days of debugging, I discovered two causes for this problem:

  1. I was referencing a package that I had installed locally, but that package was not listed in requirements.txt. Because it was not listed, it was not installed. Instead of throwing an error about not being able to find a referenced package, it fails silently and just doesn't show any of the functions.
  2. I had a circular import.

It appears that any issues involving importing are not reported or thrown, and simply cause none of the triggers to be picked up on.

Hope this helped, good luck.

Sign up to request clarification or add additional context in comments.

1 Comment

I had an obscure syntax error in my code that led to no endpoints being found. Absolutely nothing in the deployment output logs, but it caused no endpoints being found. The diagnostics seem quite poor. I've also had sporadic deployments that fail for no apparentlt valid reason, just saying "Deployment 'latest' not found", whatever that means, and I deploy it again and then it works.
1

This seems to have been an issue with cold starts - which are normally the case in Azure Functions - Consumption Plan.

A simple retry did work in this case and I was able to successfully deploy using the VS Code built in Deploy to Function App item on the Context menu of the Project.

3 Comments

I'm still having the issue right now, even after several retries
try re-creating the azure function app!
I have this issue.. but I've recreated the app multiple times and it doesn't help
0

The template code generated by default for v2 model is missing a few essential lines. Replace the code with following

try:
    import azure.functions as func
    import logging
except:
    pass

app = func.FunctionApp()

@app.function_name(name="http_trigger")
@app.route(route="hello")
def hello(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
        )

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.