question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

http_proxy/https_proxy/octokit_proxy environment not used?

See original GitHub issue

Bug 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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
issue-label-bot[bot]commented, Jul 2, 2019

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.

1reaction
gr2mcommented, Aug 23, 2019

I donā€™t think this is possible today by configuring an environment variable alone.

@octokit/rest accepts a request.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

  • A test
  • Documentation update
  • Implementation update

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?

<div> GitHub</div><div>octokit/rest.js</div><div>GitHub REST API client for JavaScript. Contribute to octokit/rest.js development by creating an account on GitHub.</div>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Octokit proxy configuration Ā· Issue #87 Ā· semantic-release ...
I have an enterprise github setup which is behind a proxy. Octokit supports this configuration but there is no notion to pass proxy...
Read more >
Module: Octokit::Configurable ā€”
URI for proxy server. ... Set configuration options using a block. #netrc? ... Returns Base URL for API requests. default: https://api.github.com/. Returns:.
Read more >
Import GitHub project behind proxy does not work - GitLab.org
We use GitLab 9.0.5-ee (Omnibus, Ubuntu). Unfortunately, we have to use a proxy to access the internet. The project import from GitHub doesĀ ......
Read more >
simple-octokit
Start using simple-octokit in your project by running `npm i ... but not only in Actions; Respects HTTP(S)_PROXY and NO_PROXY (and lowercaseĀ ...
Read more >
octokit - npm Package Health Analysis
By default, the Octokit API client does not make use of the standard proxy server environment variables. To add support for proxy serversĀ ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found