You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created new python V2 function Http Trigger using Visual Studio Code.
I have not touched the auto generated code, just deployed it.
Then from Azure Logic App, i tried to add the function in my workflow but got constantly the error: "Cannot be called from a logic app. It must not have a custom route."
Doing the same for a C# one does indeed work.
I tried also chaning the @app.route(route="test_http") to @app.route(route="req") and @app.route(methods=["POST"]) but the error on Logic App is persisting and actually did not find a way to overcome this, neither any kind of documentation about this.
Here the function code:
importazure.functionsasfuncimportloggingapp=func.FunctionApp(http_auth_level=func.AuthLevel.FUNCTION)
@app.route(route="test_http")deftest_http(req: func.HttpRequest) ->func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
name=req.params.get('name')
ifnotname:
try:
req_body=req.get_json()
exceptValueError:
passelse:
name=req_body.get('name')
ifname:
returnfunc.HttpResponse(f"Hello, {name}. This HTTP triggered function executed successfully.")
else:
returnfunc.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
)`
The text was updated successfully, but these errors were encountered:
matteogazzadi
changed the title
Visual Sutdio Code Default Python V2 http trigger function does not work with Logic App
Visual Studio Code Default Python V2 http trigger function does not work with Logic App
Apr 3, 2024
import azure.functions as func
import logging
app = func.FunctionApp()
@app.function_
@app.route() # No custom route
def http_trigger1(req: func.HttpRequest) -> func.HttpResponse:
logging.info('HTTP trigger received a request.')
name = req.params.get('name')
if not name:
return func.HttpResponse("Pass a name", status_code=400)
return func.HttpResponse(f"Hello, {name}. Function executed successfully.")
This doesn't work as well:
@app.route(route="/")
@app.route(route=None)
I created new python V2 function Http Trigger using Visual Studio Code.
I have not touched the auto generated code, just deployed it.
Then from Azure Logic App, i tried to add the function in my workflow but got constantly the error: "Cannot be called from a logic app. It must not have a custom route."
Doing the same for a C# one does indeed work.
I tried also chaning the
@app.route(route="test_http")
to@app.route(route="req")
and@app.route(methods=["POST"])
but the error on Logic App is persisting and actually did not find a way to overcome this, neither any kind of documentation about this.Here the function code:
The text was updated successfully, but these errors were encountered: