You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG]: Error on startup when using devproxy with Azure Functions Isolated Worker (HTTP/2 Connection) #851
I am trying to use devproxy with my Azure Functions (isolated worker) to simulate errors with Graph. However, after running devproxy, then launching my function in debug mode, I get the following error:
Grpc.Core.RpcException: 'Status(StatusCode="Internal", Detail="Error starting gRPC call. HttpRequestException: Requesting HTTP version 2.0 with version policy RequestVersionOrHigher while unable to establish HTTP/2 connection.", DebugException="System.Net.Http.HttpRequestException: Requesting HTTP version 2.0 with version policy RequestVersionOrHigher while unable to establish HTTP/2 connection.")'
It looks like a similar issue was reported before with Fiddler (another proxy), so it's something to do with the proxy itself:
Thanks for bringing this up @shueseman. I've seen this before, but so far, I haven't been able to figure out how to fix it. As a workaround, you can start the Azure Function first, and then start proxy. Sorry for the trouble. Let's keep the issue open in case we have a solution for it.
The function process acts like a reverse proxy to the "isolated" process
Isolated process responds
Function process returns the response to the respective output
This proxy process uses grpc (streaming) over http/2
Dev Proxy issue
If you start the dev proxy as system proxy, it will also try to proxy between functions process and isolated process, which is http/2 (default disabled, experimental, no streaming support).
Maybe it helps to not start it as system proxy and then configure the proxy only for the isolated process.
By setting the environment variable HTTPS_PROXY for the functions process.
Thanks for bringing this up @shueseman. I've seen this before, but so far, I haven't been able to figure out how to fix it. As a workaround, you can start the Azure Function first, and then start proxy. Sorry for the trouble. Let's keep the issue open in case we have a solution for it.
I ran: devproxy --as-system-proxy false
Then added an environment variable HTTPS_PROXY with value https://127.0.0.1:8000
And now on startup, it's failing during HostBuilder.Build with an exception:
AggregateException: Retry failed after 3 tries. Retry settings can be adjusted in ClientOptions.Retry or by configuring a custom retry policy in ClientOptions.RetryPolicy. (The SSL connection could not be established, see inner exception.) (The SSL connection could not be established, see inner exception.) (The SSL connection could not be established, see inner exception.)
@shueseman it seems that the function runtime also uses the dotnet http client. Can you also add the env variable NO_PROXY with the value localhost,127.0.0.1. That should disable the https proxy for all those hosts.
Here is my launchSettings.json, maybe I am not entering something correctly? When I remove the environmentVariables entries, it launches fine (but of course not using the devproxy then).
What is you loose the https:// from the proxy url? According to the docs:
The proxy server may be a hostname or IP address, optionally followed by a colon and port number, or it may be an http URL, optionally including a username and password for proxy authentication. The URL must be start with http, not https, and cannot include any text after the hostname, IP, or port.
If the dev proxy is messing with the functions runtime, what does it say? I think we have to say that setting those environment variables also messes with the Functions runtime.
The alternative way to set a proxy for all outbound http requests from the proxy is to configure a proxy in the Program.cs file.
For HTTPS_PROXY you could also use http://127.0.0.1:8000. HTTPS_PROXY means a proxy for HTTPS request, but it can still point to a proxy running on HTTP, and Dev Proxy runs on http://127.0.0.1:8000 rather than https. Awesome to hear you're unblocked!
We've got some guidance about using Dev Proxy with Azure Functions, but perhaps we should extend it with some more information to ensure others won't run into the same issue.
Activity
waldekmastykarz commentedon Aug 21, 2024
Thanks for bringing this up @shueseman. I've seen this before, but so far, I haven't been able to figure out how to fix it. As a workaround, you can start the Azure Function first, and then start proxy. Sorry for the trouble. Let's keep the issue open in case we have a solution for it.
@svrooij does this seem familiar by any chance?
svrooij commentedon Aug 21, 2024
Azure Functions Isolated work as following
This proxy process uses grpc (streaming) over http/2
Dev Proxy issue
If you start the dev proxy as system proxy, it will also try to proxy between functions process and isolated process, which is http/2 (default disabled, experimental, no streaming support).
Maybe it helps to not start it as system proxy and then configure the proxy only for the isolated process.
By setting the environment variable
HTTPS_PROXYfor the functions process.shueseman commentedon Aug 21, 2024
I did try starting the function first, then starting the proxy, but none my graph calls from the function were going through the proxy.
I will try what svrooij suggested, and let you know.
shueseman commentedon Aug 21, 2024
I ran: devproxy --as-system-proxy false
Then added an environment variable HTTPS_PROXY with value https://127.0.0.1:8000
And now on startup, it's failing during HostBuilder.Build with an exception:
AggregateException: Retry failed after 3 tries. Retry settings can be adjusted in ClientOptions.Retry or by configuring a custom retry policy in ClientOptions.RetryPolicy. (The SSL connection could not be established, see inner exception.) (The SSL connection could not be established, see inner exception.) (The SSL connection could not be established, see inner exception.)
svrooij commentedon Aug 21, 2024
@shueseman it seems that the function runtime also uses the dotnet http client. Can you also add the env variable
NO_PROXYwith the valuelocalhost,127.0.0.1. That should disable the https proxy for all those hosts.shueseman commentedon Aug 21, 2024
I am getting the same error.
Here is my launchSettings.json, maybe I am not entering something correctly? When I remove the environmentVariables entries, it launches fine (but of course not using the devproxy then).
{
"profiles": {
"MyFunctionApp": {
"commandName": "Project",
"commandLineArgs": "--port 7221",
"environmentVariables": {
"HTTPS_PROXY": "https://127.0.0.1:8000",
"NO_PROXY": "localhost,127.0.0.1"
}
}
}
}
svrooij commentedon Aug 21, 2024
What is you loose the
https://from the proxy url? According to the docs:If the dev proxy is messing with the functions runtime, what does it say? I think we have to say that setting those environment variables also messes with the Functions runtime.
The alternative way to set a proxy for all outbound http requests from the proxy is to configure a proxy in the
Program.csfile.shueseman commentedon Aug 21, 2024
That did it! Now the function app starts up, and devproxy is returning random errors on my graph calls.
Thanks!
Update, just to recap, for using devproxy with Isolated Worker Azure functions:
"HTTPS_PROXY": "127.0.0.1:8000",
"NO_PROXY": "localhost,127.0.0.1"
waldekmastykarz commentedon Aug 22, 2024
For
HTTPS_PROXYyou could also usehttp://127.0.0.1:8000.HTTPS_PROXYmeans a proxy for HTTPS request, but it can still point to a proxy running on HTTP, and Dev Proxy runs on http://127.0.0.1:8000 rather than https. Awesome to hear you're unblocked!We've got some guidance about using Dev Proxy with Azure Functions, but perhaps we should extend it with some more information to ensure others won't run into the same issue.
martinlingstuyl commentedon Nov 25, 2024
Awesome @svrooij, this unblocked me today as well!
waldekmastykarz commentedon Jun 3, 2025
We've just submitted an update to our docs and the changes should be reflected shortly. Thanks again all!