http_proxy/https_proxy/octokit_proxy environment not used?
See original GitHub issueBug Report
So i just deployed a probot stale in a Cloud Foundry and added the environment as needed for probot:
{
"APP_ID": "Iv1.id",
"GHE_HOST": "githubenterprise.mycompany",
"LOGGING_LEVEL": "trace",
"NEW_RELIC_ENABLED": "false",
"NODE_ENV": "production",
"PRIVATE_KEY": "privkey",
"WEBHOOK_SECRET": "secret",
"HTTP_PROXY": "http://proxy:8080",
"HTTPS_PROXY": "https://proxy:8080",
"OCTOKIT_PROXY": "http://proxy:8080"
}
Iām simply starting it with the command npm config set https-proxy http://proxy:8080 && npm config set http-proxy http://proxy:8080 && npm start
and `128mb of RAM after uploading the project to the cloud foundry.
The bot is starting properly with little warnings and then runs into a connection timeout since it isnāt using the proxy.
[CELL/0] [OUT] Starting health monitoring of container
[APP/PROC/WEB/0] [OUT] > probot-stale@1.1.0 start /home/vcap/app
[APP/PROC/WEB/0] [OUT] > probot run ./index.js
[APP/PROC/WEB/0] [ERR] [before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4
[APP/PROC/WEB/0] [OUT] 08:03:12.993Z INFO probot: Listening on http://localhost:8080
[APP/PROC/WEB/0] [ERR] DEPRECATED (@octokit/rest): `apps.getInstallations()` is deprecated, use `apps.listInstallations()`
[CELL/0] [OUT] Container became healthy
[CELL/0] [OUT] Cell c3bcd636-0dc6-425a-a191-fbe0092c685f destroying container for instance 5d8de719-7cf7-47d0-607a-2e39
[CELL/0] [OUT] Cell c3bcd636-0dc6-425a-a191-fbe0092c685f successfully destroyed container for instance 5d8de719-7cf7-47d0-607a-2e39
[APP/PROC/WEB/0] [OUT] 08:05:22.329Z ERROR probot: request to https://githubetnerprise.mycompany/api/v3/app/installations?per_page=100 failed, reason: connect ETIMEDOUT xxx:443
[APP/PROC/WEB/0] [OUT] HttpError: request to https://githubetnerprise.mycompany/api/v3/app/installations?per_page=100 failed, reason: connect ETIMEDOUT xxx:443
[APP/PROC/WEB/0] [OUT] at fetch.then.then.catch.error (/home/vcap/app/node_modules/@octokit/rest/lib/request/request.js:105:13)
[APP/PROC/WEB/0] [OUT] at <anonymous>
[APP/PROC/WEB/0] [OUT] at process._tickDomainCallback (internal/process/next_tick.js:229:7)
[APP/PROC/WEB/0] [OUT] 08:05:22.330Z ERROR probot: request to https://githubetnerprise.mycompany/api/v3/app/installations?per_page=100 failed, reason: connect ETIMEDOUT 194.127.88.183:443
[APP/PROC/WEB/0] [OUT] HttpError: request to https://githubetnerprise.mycompany/api/v3/app/installations?per_page=100 failed, reason: connect ETIMEDOUT xxx:443
[APP/PROC/WEB/0] [OUT] at fetch.then.then.catch.error (/home/vcap/app/node_modules/@octokit/rest/lib/request/request.js:105:13)
[APP/PROC/WEB/0] [OUT] at <anonymous>
[APP/PROC/WEB/0] [OUT] at process._tickDomainCallback (internal/process/next_tick.js:229:7)
Since i have at least one other application which is using the github enterprise api with the same route and the proxy, iām confident that the underlaying http of probot is not picking the proxy of the environment.
How do i properly setup the proxy so that probot is using it to connect to github enterprise?
It looks like Probot is not using the Octokit proxy option and Octokit itself is not picking up OCTOKIT_PROXY
. Can we add it in addition?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top GitHub Comments
Issue-Label Bot is automatically applying the label
bug š
to this issue, with a confidence of 0.85. Please mark this comment with š or š to give our bot feedback!Links: app homepage, dashboard and code for this bot.
I donāt think this is possible today by configuring an environment variable alone.
@octokit/rest
accepts arequest.agent
option which is an http/https agent:Here is a proxy test that showcases how it works: https://github.com/octokit/rest.js/blob/6b4a5d77d8f960fa727c65f2e91a01f38b3aa3fc/test/integration/agent-proxy/agent-proxy-test.js#L44
There is a workaround where you can pass your own Octokit instance to Probot, but we could also implement a new environment variable.
This would require
You can look through the code to find where we initialize the
@octokit/rest
constructor, thatās where the option would be passed in. But I think you can start with a pull request that includes the documentation update and the new test, and we take it from there?