HTTP 500 error from HTTP Triggered Azure Function even though Log Stream indicates successful completion of the function

Matthew Castrigno 5 Reputation points
2024-03-28T20:12:26.73+00:00

I have a HTTP Triggered function that runs locally in Visual Studio fine. Monitoring in the Log Stream also show successful completion. However, the browser shows a 500 error even though there is nothing to return to the browser. How can I get rid of this error message?

    public static class ValidateFunction

    {

        [FunctionName("Validate")]

        public static async Task Run(

            [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,

            ILogger log)

        {

            log.LogInformation("Validate HTTP trigger function processed a request.");

            var responsebody = await HttpService.LeanIXAPI.Validate();

            var writeResponse = FtpService.WriteFTP.WriteToArcherFTP(responsebody, "test", "./ValidationResults.txt");

            log.LogInformation($"Validate response was: {writeResponse}");

            return;

        }

    }

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