0

I created an Azure function in python to insert data into SQL server. The process was taking around a minute when I was locally testing it. But when I deployed the code, I ended up receiving 403 error as shown below.

After debugging, I realized the data was successfully persisted in the database(the whole 1 min process) but its only the response that I get is the error.

So I created a function to just sleep for 30 seconds(after some trial and error) and render a JSON response(check below code).

I get a successful response for 29 seconds or lesser but when I make the sleep to 30 seconds, I get the 403 error

import json
import azure.functions as func
import time

def main(req: func.HttpRequest) -> func.HttpResponse:
    data = req.get_json()
    data["processed"] = True
    time.sleep(30)
    return func.HttpResponse(json.dumps(data)) 

Our services aren't available right now

We're working to restore all services as soon as possible. Please check back soon.

enter image description here

I started with a consumption plan and even changed it to Functions Premium but the outcome did not change.

Rahul
  • 42,073
  • 24
  • 68
  • 100
  • Hello @Rahul, Could you please refer this SO THREAD for the similar discussion https://stackoverflow.com/questions/54625852/status-503-service-unavailable-azure-function – AjayKumarGhose-MT Mar 29 '22 at 09:57

1 Answers1

0

In Azure Functions, HTTP Error 503 Service Unavailable can be caused due to few reasons like:

  • The backend server returned 503 due to a memory leak/issue in the code.
  • Platform issue due to the backend server not running/ allocated
  • Function host is down/restarting.

enter image description here

Have a look into the "Diagnose and Solve problems" blade in the Azure Function App and select the "Function app down or reporting" detector.

enter image description here

Also, Microsoft Azure Support will do the analysis to find the root cause on your function app if we send an email at azcommunity@microsoft.com with your subscription ID as well as your function app name using function logs.

HariKrishnaRajoli-MT
  • 3,193
  • 1
  • 4
  • 18