slackapi / slack-github-action

Send data into Slack using this GitHub Action!
MIT License
938 stars 148 forks source link

Axios Post Request fails behind HTTP Proxy #131

Closed EHitchcockIAG closed 2 years ago

EHitchcockIAG commented 2 years ago

Description

Describe your issue here.

What type of issue is this? (place an x in one of the [ ])

Requirements (place an x in each of the [ ])


Bug Report

When Axios POSTs the request to HTTPS webhook (to trigger Slack Workflow) on a Github Runner acting behind a HTTP proxy, the request will hang forever. This is due to an outstanding Axios bug which hasn't been fixed.

Reproducible in:

package version: 1.22.0

node version: 16.14.2

OS version(s): Amazon Linux 2

Steps to reproduce:

  1. Configure Slack workflow and add SLACK_WEBHOOK_URL to Github Secrets.
  2. Trigger slackapi/slack-github-action in Github Agent running an HTTP proxy configured with the HTTPS_PROXY environment variable.
    steps:
      - name: Send GitHub Action trigger data to Slack workflow
        id: slack
        uses: slackapi/slack-github-action@v1.22.0
        with:
          payload: |
            {
              "version": "1.0.0",
              "message": "This came from Github!"
            }
        env:
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

Expected result:

Github Workflow passes and Webhook triggers Slack Workflow.

Actual result:

slackapi/slack-github-action runs forever in Github Workflow.

Attachments:

image

I was able to resolve this by configuring an https-proxy-agent when the request webhook uses HTTPS and the proxy uses HTTP. Link to PR in fork https://github.com/EHitchcockIAG/slack-github-action-debug/pull/2/files. Currently we are using the tag v1.23.0-alpha from the fork in our Github Workflows.

image

I'm not sure if this is an adequate solution by the team's standards. If this looks okay, I can add some tests and open a PR to main.

seratch commented 2 years ago

Hi @EHitchcockIAG, thanks a lot for writing in with details!

Can you help me understand the need you described here? The scenario is that you have a public proxy endpoint and you would like to use it for Slack webhook requests from a GitHub Actions job, right? If yes, this feature request makes sense to me and I think we should support it in future versions.

EHitchcockIAG commented 2 years ago

Hi @seratch,,

Our use case is to trigger a Slack webhook from a Github runner running behind a corporate HTTP proxy. Requests are blocked to the wider web from the Github runner unless routed through the corporate proxy.

Cheers

seratch commented 2 years ago

Help me better understand your situation a bit more. Does it mean you use on-premise github enterprise?

EHitchcockIAG commented 2 years ago

We are using Github SaaS (not the on-premise enterprise version) with an Organization, and the runner agents within this organization are AWS hosted runners

seratch commented 2 years ago

Ah I see. This makes sense. Thanks for answering! Our team is happy to have your contribution!