Our C# .Net Core project is using Google.Cloud.Firestore API version 2.5.0 and works just fine. However, the next version available is 3.0.0 and the latest is 3.5.1. To take advantage of the new features or bug fixes I am trying to update it to the latest version but without a success. Version 2.5.0 works flawlessly when we call DocumentReference..SetAsync() method but the moment I try to update the API to later or latest version I get this error.
Status(StatusCode="Internal", Detail="Error starting gRPC call. HttpRequestException: Unable to get subchannel from HttpRequestMessage. (proxy.domain.com:8080) InvalidOperationException: Unable to get subchannel from HttpRequestMessage.", DebugException="System.Net.Http.HttpRequestException: Unable to get subchannel from HttpRequestMessage. (proxy.domain.com:8080)
I tried to get answer from the internet but not successful. Therefore, I am asking this question here. What has changed in version 3.x and above and why is it not working in those versions? How can I get around this error?
Any help is greatly appreciated.
Thanks,
Vincent
Solved! Go to Solution.
@ms4446 Thank you for the information. I have not contacted the Support but while discussing the issue internally I was informed that we need to update the hosts files with some new entries. However, doing so did not make any difference. Then my lead suggested to either delete or rename the HTTP_PROXY, HTTPS_PROXY environment variables and see if that works. Yes, renaming these two environment variables did the trick.
So, it seems like HTTP_PROXY, HTTPS_PROXY environment variables were needed prior to 3.x version but from 3.x onwards we no longer need these variables.
Hope, this helps someone if they encounter the same issue.
The issue appears to stem from the gRPC connection, with misconfigured proxy settings being a likely culprit.
Troubleshooting Actions
Verify Proxy Configuration:
Environment Variables: Check that the environment variables HTTP_PROXY, HTTPS_PROXY, and ALL_PROXY are set up correctly. Adjust them if needed, or explicitly set them to direct gRPC towards your proxy settings.
Custom Configuration: In cases requiring specific proxy configurations, create an HttpClientHandler
containing your proxy information and use it to configure the GrpcChannel
for your Firestore client. See the code example below.
Enable Detailed Logging:
Trace
. Examine these logs carefully for any proxy-related problems like authentication issues or connection failures.Additional Considerations
Firewall Settings: Investigate whether your network or the proxy server itself has firewall rules that could be blocking gRPC traffic destined for Firestore. Configure necessary allowances.
Direct Connection Test: If possible, try to establish a direct connection to Firestore without the proxy. This can help isolate whether the proxy is the problem's source.
Example:
var handler = new HttpClientHandler
{
Proxy = new WebProxy("http://proxy.domain.com:8080"), // Customize as needed
UseProxy = true
};
// Include credentials if your proxy requires authentication
handler.Proxy.Credentials = new NetworkCredential("username", "password");
var channelOptions = new GrpcChannelOptions { HttpHandler = handler };
var channel = GrpcChannel.ForAddress("https://firestore.googleapis.com", channelOptions);
@ms4446 Thanks for the response. As I mentioned in my post, why upgrading the Google.Could.Firestore from 2.5.0 to 3.0.0 version will create all these problems? If it is working just fine on 2.5.0 version then it should work on 3.0.0 and greater version as well, isn't it?
I suggest reaching out to Google Cloud Support engineers who can provide in-depth knowledge of Firestore, gRPC, and how these interact with networking infrastructure like proxies.
Its recommended to have the following information ready before contacting support:
Thank you, @ms4446 . How can I contact the google support? do you have any information on that, please?
@ms4446 Thank you for the information. I have not contacted the Support but while discussing the issue internally I was informed that we need to update the hosts files with some new entries. However, doing so did not make any difference. Then my lead suggested to either delete or rename the HTTP_PROXY, HTTPS_PROXY environment variables and see if that works. Yes, renaming these two environment variables did the trick.
So, it seems like HTTP_PROXY, HTTPS_PROXY environment variables were needed prior to 3.x version but from 3.x onwards we no longer need these variables.
Hope, this helps someone if they encounter the same issue.