[BUG]: Error on startup when using devproxy with Azure Functions Isolated Worker (HTTP/2 Connection) #1221
-
DescriptionI 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: I looked over the devproxy config options and other documentation, and don't see anything that address this. Any ideas? Expected behaviourAble to startup Azure Function Isolated Worker in debug mode while devproxy is running. Actual behaviourError above is thrown during HostBuilder.RunAsync Steps to reproduceStart devproxy Dev Proxy Version0.19.1 Operating system (environment)Windows Shellcmd Configuration file{ Additional InfoNo response |
Beta Was this translation helpful? Give feedback.
Replies: 11 comments
-
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? |
Beta Was this translation helpful? Give feedback.
-
Azure Functions Isolated work as following
This proxy process uses grpc (streaming) over http/2 Dev Proxy issueIf 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 |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
I ran: devproxy --as-system-proxy false 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.) |
Beta Was this translation helpful? Give feedback.
-
@shueseman it seems that the function runtime also uses the dotnet http client. Can you also add the env variable |
Beta Was this translation helpful? Give feedback.
-
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). { |
Beta Was this translation helpful? Give feedback.
-
What is you loose the
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 var host = new HostBuilder()
.ConfigureFunctionsWorkerDefaults(functionBuilder =>
{
functionBuilder.RegisterAuthorizationMiddleware();
functionBuilder.ConfigureTablesExtension();
})
.ConfigureServices((context, services) =>
{
services.AddHttpClient().ConfigureHttpClientDefaults(builder =>
{
builder.ConfigurePrimaryHttpMessageHandler(() =>
{
return new HttpClientHandler
{
Proxy = new WebProxy("http://localhost:8000"),
ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true
};
});
})
.Build();
host.Run(); |
Beta Was this translation helpful? Give feedback.
-
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:
|
Beta Was this translation helpful? Give feedback.
-
For 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. |
Beta Was this translation helpful? Give feedback.
-
Awesome @svrooij, this unblocked me today as well! |
Beta Was this translation helpful? Give feedback.
-
We've just submitted an update to our docs and the changes should be reflected shortly. Thanks again all! |
Beta Was this translation helpful? Give feedback.
For
HTTPS_PROXY
you could also usehttp://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.