question

Bala-1076 avatar image
0 Votes"
Bala-1076 asked LimitlessTechnology-2700 answered

unable to pass input from one azure function to another functionin powershell

This is reference to the below ask
https://docs.microsoft.com/en-us/answers/questions/533843/how-to-pass-output-of-one-azure-function-to-anothe.html

I tried the solution given in the approach but struck at below error.

Thanks SamaraSoucy,

I tried calling second azure function from first one. Whereas I am getting null input to second function. And sometimes it get struck with queue and getting 500 error

function1:
$varepo = "vasamplerepo"
$vbrepo = "vbsamplerepo"

$body = @"
{
"varepo": "$varepo",
"vbrepo": "$vbrepo",
"Name" : "$name",
"message" : "invoke second function"
}
"@

$function2uri = "https://functionapp.azurewebsites.net/api/HttpTrigger2?c=="

$response = Invoke-RestMethod -Uri $function2uri -Body $body -Method Post
Write-Host $response

Associate values to output bindings by calling 'Push-OutputBinding'.

Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
StatusCode = [HttpStatusCode]::OK
Body = $response
})

2nd function:
$outname = $Request.Body.name
$va = $Request.Body.varepo
$vb = $Request.Body.vbrepo

write-Host "va is $va"
write-Host "vb is $vb"
write-Host "outname is $outname"

$body = @"
{
"va": "$va",
"vb": "$vb"
"outname" : "$outname"
}
"@

Associate values to output bindings by calling 'Push-OutputBinding'.

Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
StatusCode = [HttpStatusCode]::OK
Body = $body
})

We also tried implementing logicapps for this case whereas I am unable to pass output of one httpfunction to another.
Do we have any sample code for this to pass output from one function to another?

I got struck at below issue.

windows-server-powershellazure-functionsazure-logic-apps
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered

Hello @Bala-1076

The sample app includes code meant to exhaust memory and cause HTTP 500 errors, so you can diagnose and fix the problem using Azure Monitor. When you're finished, you'll have a sample app running on App Service on Linux integrated with Azure Monitor.

Azure Monitor maximizes the availability and performance of your applications and services by delivering a comprehensive solution for collecting, analyzing, and acting on telemetry from your cloud and on-premises environments.

firstly try Identifying the error better,

In the local directory, open the process.php and look at line 20.

imagepng($imgArray[$x], $filename);

The first argument, $imgArray[$x], is a variable holding all JPGs (in-memory) needing conversion. However, imagepng only needs the image being converted and not all images. Pre-loading images is not necessary and may be causing the memory exhaustion, leading to HTTP 500s. Let's update the code to load images on-demand to see if it resolves the issue. Next, you will improve the code to address the memory problem.

To Troubleshoot the error do follow the below link,

https://docs.microsoft.com/en-us/azure/app-service/tutorial-troubleshoot-monitor#identify-the-error

Hope this answers all your queries, if not please do repost back.
If an Answer is helpful, please click "Accept Answer" and upvote it : )

Regards,

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.