HttpRequest from Logic App is null
-
I've set up an Azure Logic App to pass the body of emails received in an Outlook 365 inbox to an Azure HTTP-triggered function, similar to the set up shown here: [Call Azure Functions from workflows - Azure Logic Apps | Microsoft Learn](https://learn.microsoft.com/en-us/azure/logic-apps/call-azure-functions-from-workflows?tabs=consumption#add-a-function-to-your-workflow-consumption--standard-workflows), although I am sending the email Body, not the "From" or "Received time" shown in the example. However, the logic app doesn't seem to be sending anything, as the HTTPRequest object received by the function is null. Any ideas what I've done wrong? The code of the logic app:
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Pass_Email_Body_to_Function_MoveitEmailProcessor": {
"inputs": {
"body": {
"emailBody": "@triggerBody()?['body']"
},
"function": {
"id": "/subscriptions//resourceGroups//providers/Microsoft.Web/sites/my-azure-function-app/functions/myHttpTriggeredFunction"
}
},
"runAfter": {},
"type": "Function"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"When_a_new_email_arrives_(V3)": {
"inputs": {
"fetch": {
"method": "get",
"pathTemplate": {
"template": "/v3/Mail/OnNewEmail"
},
"queries": {
"folderPath": "Inbox",
"from": "myemail@myemail.com"
}
},
"host": {
"connection": {
"name": "@parameters('$connections')['office365_1']['connectionId']"
}
},
"subscribe": {
"body": {
"NotificationUrl": "@{listCallbackUrl()}"
}, -
I've set up an Azure Logic App to pass the body of emails received in an Outlook 365 inbox to an Azure HTTP-triggered function, similar to the set up shown here: [Call Azure Functions from workflows - Azure Logic Apps | Microsoft Learn](https://learn.microsoft.com/en-us/azure/logic-apps/call-azure-functions-from-workflows?tabs=consumption#add-a-function-to-your-workflow-consumption--standard-workflows), although I am sending the email Body, not the "From" or "Received time" shown in the example. However, the logic app doesn't seem to be sending anything, as the HTTPRequest object received by the function is null. Any ideas what I've done wrong? The code of the logic app:
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Pass_Email_Body_to_Function_MoveitEmailProcessor": {
"inputs": {
"body": {
"emailBody": "@triggerBody()?['body']"
},
"function": {
"id": "/subscriptions//resourceGroups//providers/Microsoft.Web/sites/my-azure-function-app/functions/myHttpTriggeredFunction"
}
},
"runAfter": {},
"type": "Function"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"When_a_new_email_arrives_(V3)": {
"inputs": {
"fetch": {
"method": "get",
"pathTemplate": {
"template": "/v3/Mail/OnNewEmail"
},
"queries": {
"folderPath": "Inbox",
"from": "myemail@myemail.com"
}
},
"host": {
"connection": {
"name": "@parameters('$connections')['office365_1']['connectionId']"
}
},
"subscribe": {
"body": {
"NotificationUrl": "@{listCallbackUrl()}"
},Found the issue. For anyone who runs across this or similar problem with an HTTP-Triggered Azure function in the future it may be because you are running the function in isolated worker mode. If so you must change the footprint of the function to look for an HttpRequestData object rather than an HttpRequest object in the Run parameters and return a HttpResponseData object like this:
[Function(nameof(myHttpTriggeredFunction))]
public static HttpResponseData Run([HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequestData req, FunctionContext executionContext)
{
// processing code here
}There are no solutions, only trade-offs.
- Thomas SowellA day can really slip by when you're deliberately avoiding what you're supposed to do.
- Calvin (Bill Watterson, Calvin & Hobbes)