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

Slack Webhook doesn't respect proxy environment variables #115

Open
dokuhebi opened this issue Aug 15, 2023 · 0 comments
Open

Slack Webhook doesn't respect proxy environment variables #115

dokuhebi opened this issue Aug 15, 2023 · 0 comments

Comments

@dokuhebi
Copy link

We are running semantic-release on a private gitlab instance on our network, and all connections outside the network go through a corporate proxy. When we run with the webhook, we get the following error:

10:20:37 PM] [semantic-release] › ✘  SLACK CONNECTION FAILED request to [MASKED] failed, reason: read ECONNRESET
AggregateError: 
    SemanticReleaseError: request to [MASKED] failed, reason: read ECONNRESET
        at module.exports (/opt/app/node_modules/semantic-release-slack-bot/lib/postMessage.js:49:11)
        at async module.exports (/opt/app/node_modules/semantic-release-slack-bot/lib/success.js:119:3)
        at async validator (file:///opt/app/node_modules/semantic-release/lib/plugins/normalize.js:36:24)
        at async file:///opt/app/node_modules/semantic-release/lib/plugins/pipeline.js:37:34
        at async Promise.all (index 0)
        at async next (file:///opt/app/node_modules/p-reduce/index.js:15:44)
    at file:///opt/app/node_modules/semantic-release/lib/plugins/pipeline.js:54:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async pluginsConfigAccumulator.<computed> [as success] (file:///opt/app/node_modules/semantic-release/lib/plugins/index.js:87:11)
    at async run (file:///opt/app/node_modules/semantic-release/index.js:215:3)
    at async Module.default (file:///opt/app/node_modules/semantic-release/index.js:275:22)
    at async default (file:///opt/app/node_modules/semantic-release/cli.js:55:5) {
  errors: [
    SemanticReleaseError: request to [MASKED] failed, reason: read ECONNRESET
        at module.exports (/opt/app/node_modules/semantic-release-slack-bot/lib/postMessage.js:49:11)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async module.exports (/opt/app/node_modules/semantic-release-slack-bot/lib/success.js:119:3)
        at async validator (file:///opt/app/node_modules/semantic-release/lib/plugins/normalize.js:36:24)
        at async file:///opt/app/node_modules/semantic-release/lib/plugins/pipeline.js:37:34
        at async Promise.all (index 0)
        at async next (file:///opt/app/node_modules/p-reduce/index.js:15:44) {
      code: 'SLACK CONNECTION FAILED',
      details: undefined,
      semanticRelease: true,
      pluginName: 'semantic-release-slack-bot'
    }
  ]

Most applications in our pipelines respect the https_proxy and no_proxy environment variables, but looking through the code and the use of node-fetch, there doesn't seem to be any checks to see if a proxy is configured. The result is that we cannot make the webhook call out to Slack.

I'm not a nodejs developer (or a developer at all in any real sense), but it seems as though Node is working to get proxies working with native fetch, but until then, people have implemented workarounds.

Ideally, the application should look for a https_proxy environment variable, and if it is set, to use that proxy to make the webhook call to Slack. We also use a no_proxy variable to identify internal hosts that should not use that proxy, but I do not that functionality is necessary since the webhook will always be a proxied call.

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

No branches or pull requests

1 participant