Home > Forum > General > Http client timeout

Http client timeout
0

Hi all!

Maybe this question has already been answered before, but I am struggling with an automation and action 'Invoke REST webservice'.

I want to start REST API endpoint within a cyclical action on a daily schedule.

This is some kind of 'long running operation', at the moment it takes 10 minutes on PROD environment.

I already set execution time limit to 6000 for automation and also in global configuration, this should be fair enough.

But all I am getting is HttpClient error message after 100s.

Any ideas on how to solve this problem?

Thanks a lot in advance & best regards, Nik

MVP

Hi Nikolaus,
Looked up through dotnet docs, and it seems like it's default limit of connection duration for HttpClient class which is internally used for REST actions.
Seems like automations execution time limit doesn't override that limit too.

I'm not aware of any configuration which webcon gives to override this default value unfortunatelly.

* https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclient.timeout?view=net-8.0

On the solution - maybe using Run a PowerShell script action would help - handle that request using a PowerShell script, and just call that script from Webcon? However i'm not sure if you need some kind of response from the service.

In reply to: Maksymilian Stachowiak

Hi Nikolaus,
Looked up through dotnet docs, and it seems like it's default limit of connection duration for HttpClient class which is internally used for REST actions.
Seems like automations execution time limit doesn't override that limit too.

I'm not aware of any configuration which webcon gives to override this default value unfortunatelly.

*
https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclient.timeout?view=net-8.0

On the solution - maybe using Run a PowerShell script action would help - handle that request using a PowerShell script, and just call that script from Webcon? However i'm not sure if you need some kind of response from the service.

Hi Maksymilian!

Running Powershell from Webcon would be an alternative (e.g. starting a new thread with Start-Job).

Unfortunately there is no Powershell action available in cyclical action ...

Would be great if someone from Webcon would shed a light on this topic. Seems to be an internal (maybe hardcoded) timeout for HttpClient.

Thanks a lot!

MVP
In reply to: Nikolaus Schusser

Hi Maksymilian!

Running Powershell from Webcon would be an alternative (e.g. starting a new thread with Start-Job).

Unfortunately there is no Powershell action available in cyclical action ...

Would be great if someone from Webcon would shed a light on this topic. Seems to be an internal (maybe hardcoded) timeout for HttpClient.

Thanks a lot!

Maybe there isn't PowerShell action directly in the cyclical action, but you could create a technical 2 step workflow, and on path add that PowerShell action.

In the cycle just use start workflow action.

I'm using that workaround for sending custom mass emails sometimes. When the schedule is daily I'd say those additional entries shouldn't be a problem :)

In reply to: Maksymilian Stachowiak

Maybe there isn't PowerShell action directly in the cyclical action, but you could create a technical 2 step workflow, and on path add that PowerShell action.

In the cycle just use start workflow action.

I'm using that workaround for sending custom mass emails sometimes. When the schedule is daily I'd say those additional entries shouldn't be a problem :)

Hi Maksymilian!

That is a good suggestion, tried that.

Unfortunately it didn't work.

Maybe Start-Job is not the right choice, because it starts a new thread.

If I run the attached script directly on server, it works like a charm.

Could you please post a snippet on how you are starting powershell script?

Thank you & have a nice day!

MVP
In reply to: Nikolaus Schusser

Hi Maksymilian!

That is a good suggestion, tried that.

Unfortunately it didn't work.

Maybe Start-Job is not the right choice, because it starts a new thread.

If I run the attached script directly on server, it works like a charm.

Could you please post a snippet on how you are starting powershell script?

Thank you & have a nice day!

I'd just skip that Start-Job, in my example I'm just generating an XML file, but as a direct script, without any additional functions.

New thread shouldn't be necessary, just add -TimeoutSec parameter, to make PowerShell wait for the request to complete.
Invoke-WebRequest https://www.example.com/longrunningtask -ConnectionTimeoutSeconds 60 -OperationTimeoutSeconds 60 (would try both)

Did you know that with WEBCON you can automate virtually any process? Even baking cookies 🍪
 
Speaking of cookies: we use the ones that are essential for our website to function properly, as well as additional ones that help us customize our content to your preferences. If you don’t mind cookies, click Accept. If you want to learn more, explore settings.
Settings