Function App sends 503 response after 30 seconds

MorganAdam-0661 1 Reputation point
2022-09-27T15:38:56.507+00:00

I'm developing a new PowerShell Function App, and when testing in the portal it succeeds in about 55 seconds, but returns a 503 error ("Service Unavailable") after 30 seconds, every time. If I comment-out enough of the code, it finishes in less than 30 seconds and returns a successful response. Is there an application setting I can add to force it to wait longer than 30 seconds before returning a response? Thanks!

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,261 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 12,421 Reputation points
    2022-09-28T07:13:54.433+00:00

    Hi @MorganAdam-0661 ,

    Thanks for reaching out to Q&A forum.

    If your function is timing out after 50 seconds, you can increase the timeout value by specifying it in the host.json file.

    https://learn.microsoft.com/en-us/azure/azure-functions/functions-host-json#functiontimeout

    If you want the powershell script to pause/wait for certain amount of time so that certain commands can complete its operation, then you can use the "Start-Sleep" command to suspend the activity in a script or session for the specified period of time.

    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/start-sleep?view=powershell-7.2&viewFallbackFrom=powershell-7.1

    Hope this helps! Feel free to reach out to me if you have any questions or concerns.

    0 comments No comments