Azure / azure-functions-python-worker

Python worker for Azure Functions.
http://aka.ms/azurefunctions
MIT License
331 stars 100 forks source link

[BUG] Functions no longer callable from logic apps after migrating to V2 model (python) #1439

Open ManelBH opened 3 months ago

ManelBH commented 3 months ago

Investigative information

Repro steps

1 - Define a function using the V2 python model and blueprints:

import azure.functions as func
import logging

app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)

@app.route()
def http_trigger(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)
  1. Deploy the function.
  2. I verify http_trigger shows in the function app in Azure
  3. Try to call the function from a logic app using the "Azure Functions" action

Expected behavior

I can select the "http_trigger" method just like with the V1 model.

Actual behavior

The list of available methods is empty

image

Contents of the requirements.txt file:

azure-functions

Notes:

The same behaviour is observed when using blueprints:

import azure.functions as func
import logging

bp = func.Blueprint()

@bp.route()
def http_trigger(req: func.HttpRequest) -> func.HttpResponse:
    ...

app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)
app.register_blueprint(bp)
bhagyshricompany commented 3 months ago

Thanks for reporting will check and update.

bhagyshricompany commented 3 months ago

Hi @ManelBH are you trying like this.seems working fine.if not please mention all the steps.Thanks ref:https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-scenario-function-sb-trigger

image
ManelBH commented 3 months ago

Hi @bhagyshricompany, I'm using Consumption Logic Apps.

bhagyshricompany commented 3 months ago

ok will update.

bhagyshricompany commented 3 months ago

@gavin-aguiar pls comment and validate.Thanks