this is probably a noob question. I have an Azure Function that responds to HTTP requests and it works fine, I can call it from a browser or from a Python 3.8 script.
I want to make another function that will have Timer Trigger
and will call the HTTP trigger function
on a schedule.
HTTP Trigger function
returns a simple string with execution results.
Now my code for Timer trigger function
is using Python Requests
and it works locally every time, but will work only 1/10 times when deployed to Azure. Other times it returns error when it reaches timeout of 30 minutes. The whole thing should run only for 1-2 minutes max so I don't understand where it gets stuck.
When successful it works(I can see in backend of HTTP trigger script
), but in azure logs the logger saves 404 error
page html instead of the string that HTTP trigger function
should return.
Here is the code for Timer Trigger function:
import datetime
import logging
import azure.functions as func
import requests
def main(mytimer: func.TimerRequest) -> None:
URL = "https://rob-functions.azurewebsites.net/api/ss_kite_scrape_http"
r = requests.get(url = URL)
data = r.text
logging.info(f'TIMER TRIGGER HAS RUN. RESULT:{data}')
How to troubleshoot or fix this? The logging issue is not so important but the timeout issue has to be fixed somehow and I have no idea where to start since it works perfectly locally.