Skip to content
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

Zscaler corporate proxy companion app is not working with wakatime #768

Open
mt3o opened this issue Aug 26, 2022 · 4 comments
Open

Zscaler corporate proxy companion app is not working with wakatime #768

mt3o opened this issue Aug 26, 2022 · 4 comments
Assignees
Labels

Comments

@mt3o
Copy link

mt3o commented Aug 26, 2022

Hi, i have issue with current version of Wakatime client app - it can't get thru corporate proxy.
The proxy is running on http://localhost:9000 and other programs seem to respect this setting, however WakaTime replies as follows:

{"caller":"pkg/api/diagnostic.go:28","func":"api.(*Client)","level":"debug","message":"sending diagnostic data to api at https://api.wakatime.com/api/v1/plugins/errors","now":"2022-08-26T09:45:14+02:00","version":"v1.54.0"}
{"caller":"cmd/run.go:276","func":"cmd.runCmd","level":"warning","message":"failed to send diagnostics: failed to send diagnostics to the API: failed making request to \"https://api.wakatime.com/api/v1/plugins/errors\": Post \"https://api.wakatime.com/api/v1/plugins/errors\": proxyconnect tcp: dial tcp :0: connectex: The requested address is not valid in its context.","now":"2022-08-26T09:45:14+02:00","version":"v1.54.0"}

I'm not sure if you are verifying somehow the proxy address in the new version, but it's not working as it should. It was working with python version.

Issue is remotely related to wakatime/jetbrains-wakatime#127 but this time i checked deeper - trying the cli.

@gandarez gandarez added question and removed triage labels Aug 26, 2022
@gandarez gandarez self-assigned this Aug 26, 2022
@gandarez
Copy link
Member

Hi @mt3o

It doesn't auto-detect proxy settings from the machine. Please try setting up proxy into your ~/.wakatime.cfg file. For more information on how to do please refer to proxy here.

@mt3o
Copy link
Author

mt3o commented Aug 29, 2022

Hi @gandarez

Of course the ~/.wakatime.cfg file has the proper line regarding the proxy. At least the same value that lets wget do to its job.
I tried all sorts of setups, pointing to either zscaler companion app, listening on port 9000 on localhost, or company gateway.
I tried also setting it by inline argument --proxy for wakatime-cli.
Here is what I get at best:

"AppData\Roaming\WakaTime\wakatime-cli\wakatime-cli.exe" --proxy http://localhost:9000 --log-to-stdout --verbose --sync-offline-activity 1000
INFO 2022/08/29 08:46:19 attempting to merge in config file
INFO 2022/08/29 08:46:19 attempting to merge in config file
INFO 2022/08/29 08:46:19 attempting to merge in config file
INFO 2022/08/29 08:46:19 attempting to merge in config file
{"caller":"cmd/run.go:111","func":"cmd.Run","level":"debug","message":"command: sync-offline-activity","now":"2022-08-29T08:46:19+02:00","version":"v1.54.0"}
{"caller":"pkg/offline/offline.go:106","func":"offline.WithSync","level":"debug","message":"execute offline sync with file C:\\Users\\xxxx\\.wakatime.bdb","now":"2022-08-29T08:46:19+02:00","version":"v1.54.0"}
{"caller":"pkg/offline/offline.go:151","func":"offline.Sync","level":"debug","message":"send 25 heartbeats on sync run 1","now":"2022-08-29T08:46:19+02:00","version":"v1.54.0"}
{"caller":"pkg/apikey/apikey.go:31","func":"apikey.WithReplacing","level":"debug","message":"execute api key replacing","now":"2022-08-29T08:46:19+02:00","version":"v1.54.0"}
{"caller":"pkg/api/heartbeat.go:27","func":"api.(*Client)","level":"debug","message":"sending 25 heartbeat(s) to api at https://api.wakatime.com/api/v1/users/current/heartbeats.bulk","now":"2022-08-29T08:46:19+02:00","version":"v1.54.0"}

...

{"caller":"cmd/run.go:270","func":"cmd.runCmd","level":"error","message":"failed to run command: offline sync failed: failed to sync offline heartbeats: failed making request to \"https://api.wakatime.com/api/v1/users/current/heartbeats.bulk\": Post \"https://api.wakatime.com/api/v1/users/current/heartbeats.bulk\": read tcp [::1]:53718->[::1]:9000: wsarecv: An existing connection was forcibly closed by the remote host.","now":"2022-08-29T08:43:52+02:00","version":"v1.54.0"}
{"caller":"pkg/api/diagnostic.go:28","func":"api.(*Client)","level":"debug","message":"sending diagnostic data to api at https://api.wakatime.com/api/v1/plugins/errors","now":"2022-08-29T08:43:52+02:00","version":"v1.54.0"}
{"caller":"cmd/run.go:276","func":"cmd.runCmd","level":"warning","message":"failed to send diagnostics: failed to send diagnostics to the API: failed making request to \"https://api.wakatime.com/api/v1/plugins/errors\": Post \"https://api.wakatime.com/api/v1/plugins/errors\": read tcp [::1]:53719->[::1]:9000: wsarecv: An existing connection was forcibly closed by the remote host.","now":"2022-08-29T08:43:52+02:00","version":"v1.54.0"}

or

"AppData\Roaming\WakaTime\wakatime-cli\wakatime-cli.exe" --proxy http://gateway.zscaler.net --log-to-stdout --verbose --sync-offline-activity 1000
INFO 2022/08/29 08:48:13 attempting to merge in config file
INFO 2022/08/29 08:48:13 attempting to merge in config file
INFO 2022/08/29 08:48:13 attempting to merge in config file
INFO 2022/08/29 08:48:13 attempting to merge in config file
{"caller":"cmd/run.go:111","func":"cmd.Run","level":"debug","message":"command: sync-offline-activity","now":"2022-08-29T08:48:13+02:00","version":"v1.54.0"}
{"caller":"pkg/offline/offline.go:106","func":"offline.WithSync","level":"debug","message":"execute offline sync with file C:\\Users\\xxxx\\.wakatime.bdb","now":"2022-08-29T08:48:14+02:00","version":"v1.54.0"}
{"caller":"pkg/offline/offline.go:151","func":"offline.Sync","level":"debug","message":"send 25 heartbeats on sync run 1","now":"2022-08-29T08:48:14+02:00","version":"v1.54.0"}
{"caller":"pkg/apikey/apikey.go:31","func":"apikey.WithReplacing","level":"debug","message":"execute api key replacing","now":"2022-08-29T08:48:14+02:00","version":"v1.54.0"}
{"caller":"pkg/api/heartbeat.go:27","func":"api.(*Client)","level":"debug","message":"sending 25 heartbeat(s) to api at https://api.wakatime.com/api/v1/users/current/heartbeats.bulk","now":"2022-08-29T08:48:14+02:00","version":"v1.54.0"}

...

{"caller":"cmd/run.go:270","func":"cmd.runCmd","level":"error","message":"failed to run command: offline sync failed: failed to sync offline heartbeats: failed making request to \"https://api.wakatime.com/api/v1/users/current/heartbeats.bulk\": Post \"https://api.wakatime.com/api/v1/users/current/heartbeats.bulk\": Forbidden","now":"2022-08-29T08:48:14+02:00","version":"v1.54.0"}
{"caller":"pkg/api/diagnostic.go:28","func":"api.(*Client)","level":"debug","message":"sending diagnostic data to api at https://api.wakatime.com/api/v1/plugins/errors","now":"2022-08-29T08:48:14+02:00","version":"v1.54.0"}
{"caller":"cmd/run.go:276","func":"cmd.runCmd","level":"warning","message":"failed to send diagnostics: failed to send diagnostics to the API: failed making request to \"https://api.wakatime.com/api/v1/plugins/errors\": Post \"https://api.wakatime.com/api/v1/plugins/errors\": Forbidden","now":"2022-08-29T08:48:14+02:00","version":"v1.54.0"}

Here is the ~/.wakatime.cfg:

[settings]
api_key = xxxx
proxy = localhost:9000
debug = true

status_bar_enabled = true

The messages from cli are a little different from what log tells when using intellij, but still there is no success in pushing the events.

@gandarez
Copy link
Member

Do you need authentication in order to use proxy? Try setting user and pass like so http://user:pass@localhost:9000.

@mt3o
Copy link
Author

mt3o commented Sep 8, 2022

@gandarez usual programs don't need authentication. If they do, explicit login form is being shown in the browser. However tools like npm, maven or just wget don't have problems when proxy is configured.
What brings issues - is ssl mismatch, as the proxy replaces certificates. Of couse i have no_ssl_verify = true in the config file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants