when we do APi calls from powershell, We see issue intermittent like 504 (Gateway Timeout). it seems this error happens because of delay in response from the server than expected… how can we fix this because we have customized powershell scripts to do APIs…
I see this error intermittently for few minutes… Later it worked… You mean to say the network could have been not stable, so this need to be addressed with network team.
Yes since the server where your PowerShell script is running is within customer network, it’s always good to validate the firewall rules are properly placed + network connectivity is working fine, as it can be a problem if it happens in Production with intermittent behavior.
Also, increasing timeout + adding retries on your API call is another option worth trying if it resolves.
Agree with this being “standard error handling” which many of us (me included) don’t always include in our PowerShell scripting assuming things are ALWAYS going to work as expected.