Skip to content

Commit 2e21fc7

Browse files
authored
Error handling for http proxying (#9342)
1 parent 08d5280 commit 2e21fc7

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

release_notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
- Patch Durable Functions Extension version check (https://github.com/Azure/azure-functions-host/pull/9331)
88
- Update Java Worker Version to [2.12.0](https://github.com/Azure/azure-functions-java-worker/releases/tag/2.12.0)
99
- Remove feature flag for http proxying (https://github.com/Azure/azure-functions-host/pull/9341)
10+
- Add error handling for http proxying failure scenarios (https://github.com/Azure/azure-functions-host/pull/9342)

src/WebJobs.Script.Grpc/Channel/GrpcWorkerChannel.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -963,24 +963,23 @@ internal async Task InvokeResponse(InvocationResponse invokeResponse)
963963
{
964964
if (invokeResponse.Result.IsInvocationSuccess(context.ResultSource, capabilityEnabled))
965965
{
966-
if (IsHttpProxyingWorker)
966+
_metricsLogger.LogEvent(string.Format(MetricEventNames.WorkerInvokeSucceeded, Id));
967+
968+
try
967969
{
968-
if (context.Properties.TryGetValue(ScriptConstants.HttpProxyTask, out Task<ForwarderError> httpProxyTask))
970+
if (IsHttpProxyingWorker)
969971
{
970-
ForwarderError httpProxyTaskResult = await httpProxyTask;
971-
972-
if (httpProxyTaskResult is not ForwarderError.None)
972+
if (context.Properties.TryGetValue(ScriptConstants.HttpProxyTask, out Task<ForwarderError> httpProxyTask))
973973
{
974-
// TODO: Understand scenarios where function invocation succeeds but there is an error proxying
975-
// need to investigate different ForwarderErrors and consider how they will be relayed through other services and to users
974+
ForwarderError httpProxyTaskResult = await httpProxyTask;
975+
976+
if (httpProxyTaskResult is not ForwarderError.None)
977+
{
978+
throw new InvalidOperationException($"Failed to proxy request with ForwarderError: {httpProxyTaskResult}");
979+
}
976980
}
977981
}
978-
}
979-
980-
_metricsLogger.LogEvent(string.Format(MetricEventNames.WorkerInvokeSucceeded, Id));
981982

982-
try
983-
{
984983
StringBuilder logBuilder = new StringBuilder();
985984
bool usedSharedMemory = false;
986985

0 commit comments

Comments
 (0)