0
votes

I have a simple Azure Logic app that is trigger by a new email and then passes the Body to my Function App to remove HTML.

I am getting a 404 not found error and I'm a bit stuck as to what is actually not being found.

I can click on the url and it tells me that my function app is up and running and I've selected the Function App from a list in the Logic App editor. enter image description here Are there any log files or something that can provide a bit more information as to what cannot be found?

I think the issue might be that my Function app hasn't published correctly. In VS I am getting a missing trigger attribute but I'm not sure what to add.

Code:

 public static class Function1
    {
        [FunctionName("RemoveHTMLfunction")]

        public static async Task<IActionResult> Run(HttpRequest req, ILogger log)
        {

            log.LogInformation("HttpWebhook triggered");

            string emailBodyContent = await new StreamReader(req.Body).ReadToEndAsync();

            String updatedBody = WebUtility.HtmlDecode(RemoveHtmlMarkup(emailBodyContent));
            
            return (ActionResult)new OkObjectResult(new { updatedBody });
        }
1
If this is a Http Triggered function then should it not have the binding as [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] where AuthorizationLevel should be as per your need. How did you get this signature? You can open the VS and click on the project to add a new Http trigger function. Once created then you can publish either from VS or CI/CD to deploy to your subscription. - user1672994
1) Why not use inline JS instead of a function if all you want is simple parsing? 2) No idea why 404, but you could open the Dev Tools in your Firefox/Chrome and then see what call is causing 404. - Kashyap

1 Answers

1
votes

If you just want to get the body without HTML of the email, you can use Body Preview:

enter image description here

According to the running results, the body obtained by Body has HTML, but Body Preview does not.

enter image description here