-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firestore Client Does Not Work Behind a Proxy #493
Comments
It seems the auth library is at fault here. It's not connecting to the HTTP proxy correctly. If I just set the
Squid log:
It seems I must set the HTTPS_PROXY variable for the credentials to go through the proxy, but it doesn't work with plain HTTP. |
@hiranya911 We've release 0.21.0 which addressed the issue with running behind a proxy. Can you try now and see if it resolves it? Thanks! |
@stephenplusplus I understand you have a test utility for proxy issues - can you please take a look at this? Thanks :) |
@stephenplusplus will help with verifying this |
I believe @ajaaym found a solution:
|
@JustinBeckwith @jkwlui with the release of 2.1.1 i can no longer hit firestore over a proxy. i have tried setting https_proxy, HTTPS_PROXY, http_proxy, HTTP_PROXY. It looks like 2.1.1 added "@grpc/grpc-js": "0.4.0". and from taking a quick look in that repo i dont see anything about grpc-js accepting proxy support? What do either of you think would be the best way to move forward? |
That's unfortunate, I will look into that. I believe you could use a workaround where you provide the proxy endpoint programmatically in the constructor. @schmidt-sebastian is that possible? In other languages, it would look something like: new Client({ apiEndpoint: 'https://localhost:8080' })
new Client({ host: 'localhost', port: '8080' }) |
The recommended syntax is:
Note: We now also support non-SSL endpoints directly:
|
so that would work fine, but im behind a corporate proxy and need to pass in proxy authentication credentials. whenever i do so i get a Value for argument "settings.host" is not a valid host. @schmidt-sebastian @stephenplusplus in addition im getting this issue across other google apis projects like dialogflow or probably anything that is using grpc-js. |
@amammay How do you pass these credentials? If they are HTTP headers, you can pass them in a such
|
@schmidt-sebastian well passing in the credentials would be of the format of http://[user]:[pass]@hostname:port and for the firebase settings you can only pass in host and port as https://github.com/googleapis/nodejs-firestore/blob/master/types/firestore.d.ts#L56 |
FWIW, we also support |
@hiranya911 Is this still an issue? We are now using Node's HTTP2 module for our networking. |
I've never tried this scenario with a proxy that requires authentication. Does the new implementation still support the |
I have not been able to successfully proxy any Firestore calls. I can proxy the token call but no requests to Firestore actually hit the proxy. I am using the latest version. |
The admin SDK uses grpc-js, which currently does not support proxies (issue). However, the native grpc library does support proxies using One way to circumvent this limitation would be to provide a the native GRPC implementation to the admin SDK via the constructor argument as detailed in this comment, which also details why we use grpc-js instead of native grpc. |
@thebrianchen thanks for the tip. I gave this a shot, configured my app as the comment suggests, and using Charles proxy on my machine and I see the auth call hit the proxy but I do not see any calls to my Firestore database that hit the proxy. |
@thebrianchen my apologies, I am hitting the proxy now I was using the wrong casing for the environment variable. HTTP_PROXY !== http_proxy |
@thebrianchen thank you!! |
@zamnuts would you mind giving this a glance when you have a chance? From your recent experience with proxy support inside grpc-node, maybe we've resolved this already? And if not, do you know what issues are standing in the way? |
|
If you update your dependencies, you should now be using |
Environment details
@google-cloud/firestore
version: 0.19.0Steps to reproduce
Trying to access Firestore through a simple HTTP proxy. According to the instructions in this article, Node.js GRPC supports specifying a proxy via an environment variable.
HTTPS_PROXY
environment variableGRPC debug log
HTTP proxy log (Squid proxy access log)
Note that this problem is unique to the Firestore Node.js client. I've tried the same with Java and Go clients where this use case works fine.
The text was updated successfully, but these errors were encountered: