'How to manually call httpTrigger Azure Function within another
I have a JavaScript httpTrigger Function on Azure that I want to call in another httpTrigger Function. Both are in the same resource group. I know about Durable Functions and Queue Storage but (according to my limited knowledge) neither is perfect in this scenario because:
- I'd have to change the Function to activityTrigger to use Durable Functions, meaning that I wouldn't be able to use it separately to handle HTTP requests.
- if I used the Function in Queue Storage, it would trigger the other Function every time it's called, which is not what I want.
Edit: I decided to go with Durable Functions after all. To anyone who wants to build a workflow on Microsoft infrastructure, there are typically a few options to choose from, including what was recommended by other users below:
- Durable Functions
- Logic App
- BizTalk Server
- HTTP request
Solution 1:[1]
I decided to use Durable Functions.
Durable Functions require setting up a storage service for the Function App. You'll need to add a few application settings in your Function App (below) but before you do that, back up your current functions.
- WEBSITE_CONTENTSHARE — to get the value, navigate to your storage and go to
File shares
- WEBSITE_CONTENTAZUREFILECONNECTIONSTRING — use either of the
Access keys
from your storage account - AzureWebJobsStorage — use the storage account's name, which you can also get in
Access keys
Solution 2:[2]
You can use a http
module to call another function
var http = require('http');
module.exports= function (context) {
context.log('JavaScript HTTP trigger function processed a request.');
var options = {
host: '<Another Function URL>',
port: '80',
path: '/test',
method: 'POST'
};
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Katergin |
Solution 2 | SwethaKandikonda-MT |