web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Request to the backend...
Power Automate
Unanswered

Request to the backend service timed out for Action when used with C# script custom code

(1) ShareShare
ReportReport
Posted on by 6

I am trying to use C# code to override a header value in the action call on runtime. 

But as the nature of the Api, it takes more than 5 seconds to return the response as the size of the file increases.

Now if I use the policy template(set header) to override the header, power automate handles the excess time taken without any issues. but even if I just enable a bit of the code on this action, it starts giving internal server error for request timeout.
Now I know its mentioned that the C# code should itself execute within 5 seconds. But why is it counting the time taken after the call has been made by power automate inside the script execution time.
Since I know the request times out right exactly after 5 seconds, this must be the reason for including that time in script execution.
very basic C# script being used as testing

 

 

 

public class Script : ScriptBase
{
 public override async Task<HttpResponseMessage> ExecuteAsync()
 {
 var response = await this.Context.SendAsync(this.Context.Request, this.CancellationToken).ConfigureAwait(false);

	 return response;
 }
}

 

 

 



Now how can I configure power automate to increase/alter the request timeout for a single request via custom code or others methods if any. 
Since I have other things to do via custom code as well for this action, I can't just use policy header to set the header value.

The error code. 

 

 

 

{
 "error": {
 "code": 500,
 "message": "Request to the backend service timed out",
 "source": "msmanaged-na.azure-apim.net",
 "path": "choose[7]\\when[1]\\choose[1]\\when[1]\\send-request",
 "policyId": "",
 "clientRequestId": "67b79601-f595-41a9-a003-021bc7135437"
 }
}

 

 

 


thanks, in advance.

Categories:

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 227 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 221 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 132

Last 30 days Overall leaderboard