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

ETIMEDOUT : API call #733

Closed
1itachi opened this issue Feb 18, 2021 · 13 comments · Fixed by #837
Closed

ETIMEDOUT : API call #733

1itachi opened this issue Feb 18, 2021 · 13 comments · Fixed by #837

Comments

@1itachi
Copy link

1itachi commented Feb 18, 2021

Timeout error for API call

Creates new branch and commits all changes just as expected but fails with the following error:
_Error: request to https://api.github.com/repos/org/repo/pulls failed, reason: connect ETIMEDOUT_
When I run the curl with the token and URL, I get a successful result.

Steps to reproduce

Runs as a scheduler:

 - name: Create Pull Request
      uses: peter-evans/create-pull-request@v3.8.2
      with:
          token: ${{ secrets.ACCESS_PAT }}
          base: master

I am unsure if this is a bug or configuration error on my part.

@peter-evans
Copy link
Owner

Hi @itachi1994

Are you running on self-hosted? A quick search on Google reveals that this kind of error often occurs when behind a corporate proxy.

@1itachi
Copy link
Author

1itachi commented Feb 19, 2021

Hi, @peter-evans Thank you for the reply. I think this is the case.

@1itachi 1itachi closed this as completed Feb 19, 2021
@peter-evans
Copy link
Owner

If you found a way to fix it I'm interested to know.

@1itachi
Copy link
Author

1itachi commented Feb 21, 2021

@peter-evans I was not able to find a way to fix this issue. I ended up using the "hub" directly.

@1itachi
Copy link
Author

1itachi commented Mar 10, 2021

@peter-evans My observation: Connection time out happens for self-hosted runners with proxy settings even with the personal access token but if the same action is containerized with docker it works fine. Hope this makes sense.

@1itachi 1itachi reopened this Mar 12, 2021
@1itachi
Copy link
Author

1itachi commented Mar 12, 2021

@peter-evans The entire log here:

Run peter-evans/create-pull-request@v3
Save persisted git credentials
Determining the base and head repositories
Pull request branch target repository set to repo
Configuring credential for HTTPS authentication
Checking the base repository state
Pull request branch to create or update set to 'test-automate'
Configuring the committer and author
Create or update the pull request branch
Pushing pull request branch to 'origin/test-automate'
  /usr/bin/git push --force-with-lease origin HEAD:refs/heads/test-automate
  remote: 
  remote: Create a pull request for 'test-automate' on GitHub by visiting:        
  remote:      https://github.com/repo-internal/repo/pull/new/test-automate        
  remote: 
  To https://github.com/repo-internal/repo
   * [new branch]      HEAD -> test-automate
Error: request to https://api.github.com/repos/repo-internal/repo/pulls failed, reason: connect ETIMEDOUT 140.82.121.6:443
Restore persisted git credentials

@peter-evans
Copy link
Owner

Try setting your corp proxy as an environment variable like this.

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v3
        env:
          http_proxy: http://<proxy_address>:<port>

@1itachi
Copy link
Author

1itachi commented Mar 12, 2021

Thank you for the reply. I tried using this, same error.

@anzboi
Copy link

anzboi commented May 21, 2021

Very late here, but this error is still here, and is actually a bit of an oversight by the community.

Octokit does not by default look up https_proxy environment variables to route its requests. This actually makes sense in a broader view of what octokit is meant to do, but unfortunately it means most javascript actions simply cannot run on self-hosted runners sitting behind a proxy.

Octokit has a constructor for use in actions, but it is not widely used, and even if it was, it also does not read proxy env vars yet. Ideally the fix would go in there but it would take a long time to proliferate across javascript actions.

@peter-evans
Copy link
Owner

peter-evans commented May 21, 2021

@anzboi Thank you for investigating! The most widely used constructor for Octokit in actions is probably the one in the actions toolkit here: https://github.com/actions/toolkit/blob/main/packages/github/src/utils.ts
It might help the community to add support for it there.

This action just uses octokit/core, though, because I wanted a little more control over its construction.

I might be able to add the suggestion in this comment to the action.
octokit/octokit.js#2098 (comment)

@peter-evans
Copy link
Owner

peter-evans commented May 22, 2021

@anzboi @itachi1994

I've attempted to add proxy support to the action, but I haven't figured out a good way to test it yet. If either of you are able to test it out, that would be a great help.

You can test it like this using the branch of PR #837

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@proxy-support
        env:
          https_proxy: http://<proxy_address>:<port>

@peter-evans
Copy link
Owner

@peter-evans
Copy link
Owner

Released as v3.10.0 / v3

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

Successfully merging a pull request may close this issue.

3 participants