-1

Very simply! I have a function app - function_app.py, trigger.py and init.py in the root

Its my first Azure Function App. if i run the two files separately, function_app.py, trigger.py, they both return the results. Trigger.py looks at a file on sharepoint and does some cleansing and reposts it back to sharepoint.

Trigger.py has a function called Trigger() and within that, the function connects to Sharepoint, looks at a file, then does some changes and then uploads it again. This does 100% work.

The problem lies with when i call it from the Function_App.py as I want to deploy this as a Azure Function App.

i've created a trigger. Runs fine; on deployment, it times out. When I debug, it gives the following

Found Python version 3.11.9 (py).

Azure Functions Core Tools
Core Tools Version:       4.0.7030 Commit hash: N/A +bb4c949899cd5659d6bfe8b92cc923453a2e8f88 (64-bit)
Function Runtime Version: 4.1037.0.23568

[2025-04-24T17:18:19.054Z] Requesting metadata from worker failed.
[2025-04-24T17:18:19.057Z] Microsoft.Azure.WebJobs.Script.Grpc: The operation has timed out.

The function_app looks like below:

import azure.functions as func
import logging
import json
from azure.functions import HttpRequest, HttpResponse
from  myFile import Trigger
    app = func.FunctionApp()
    @app.function_name(name="Trigger")
    @app.route(route="myApp", auth_level=func.AuthLevel.ANONYMOUS)
    def mytrigger(req: func.HttpRequest) -> func.HttpResponse:
        try:
            # Call the Trigger function
            Trigger()  # This runs the entire process you defined
            # Return a success message
            return func.HttpResponse(" process completed successfully.", status_code=200)
        except Exception as e:
            logging.error(f"Error executing  process: {str(e)}")
            return func.HttpResponse(f"An error occurred: {str(e)}", status_code=500)

If I don't import the file or call Trigger(), the function_app.py runs as normal and opens up the URL with the response. So, I don't understand why calling this within, is causing heartache.

The files are in the root of Project. I don't have them spread in different folders. Please someone tell me why something so simple is not working.

16
  • Move the heavy logic in Trigger() to a separate queue-triggered function to avoid timeout in your HTTP-triggered Azure Function. Commented Apr 25 at 3:33
  • Can you share your trigger.py and init.py codes in the question? Commented Apr 25 at 3:44
  • 1
    @Dave Ensure proper async handling in the Trigger() function to prevent blocking during SharePoint operations. Provide your code will try from my end. Commented Apr 25 at 10:29
  • 1
    Added Trigger.py to the top with rest of other code Commented Apr 25 at 11:17
  • 1
    @DasariKamali i figured it out. I needed a folder that was the same name as the decorator and place those files in that folder of the same name. Commented Apr 29 at 9:10

1 Answer 1

-1

The decorator had a function name explicitly named Trigger.

I needed to create a folder in Azure Function App called Trigger and place my files inside this folder. I originally had them in the root.

Issue resolved on moving files into Trigger folder.

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

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.