Skip to content

Commit

Permalink
Merge pull request #782 from heroku/warn-proxy
Browse files Browse the repository at this point in the history
warn if http_proxy/https_proxy set and no_proxy is not aws
  • Loading branch information
lillianzhang331 authored May 13, 2020
2 parents 39bf498 + 4798ecc commit 50e73aa
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## master
- display yarn engine log to build output when engine is provided in monorepo ([#771](https://github.com/heroku/heroku-buildpack-nodejs/pull/771))
- move proxy issues section from readme to dev center ([#778](https://github.com/heroku/heroku-buildpack-nodejs/pull/778))
- warn when NO_PROXY is not set to "amazonaws.com" and HTTP_PROXY or HTTPS_PROXY is set ([#782](https://github.com/heroku/heroku-buildpack-nodejs/pull/782))

## v171 (2020-04-27)
- Update Travis badge to `master` and other changes in README ([#753](https://github.com/heroku/heroku-buildpack-nodejs/pull/753))
Expand Down
1 change: 1 addition & 0 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ handle_failure() {
fail_yarn_install "$LOG_FILE" "$BUILD_DIR"
fail_invalid_semver "$LOG_FILE"
log_other_failures "$LOG_FILE"
warn_aws_proxy "$BUILD_DIR"
warn_untracked_dependencies "$LOG_FILE"
warn_angular_resolution "$LOG_FILE"
warn_missing_devdeps "$LOG_FILE" "$BUILD_DIR"
Expand Down
6 changes: 6 additions & 0 deletions lib/failure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,12 @@ warn() {
echo ""
}

warn_aws_proxy() {
if { [[ -n "$HTTP_PROXY" ]] || [[ -n "$HTTPS_PROXY" ]]; } && [[ "$NO_PROXY" != "amazonaws.com" ]]; then
warn "Your build may fail if NO_PROXY is not set to amazonaws.com" "https://devcenter.heroku.com/articles/troubleshooting-node-deploys#aws-proxy-error"
fi
}

warn_node_engine() {
local node_engine=${1:-}
if [ "$node_engine" == "" ]; then
Expand Down
16 changes: 16 additions & 0 deletions test/run
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,22 @@ testOldNpmWithLockfile() {
assertCapturedSuccess
}

testWarnAwsProxyHttp() {
env_dir=$(mktmpdir)
echo "http://localhost:5001" > $env_dir/HTTP_PROXY
compile "node-10" "$(mktmpdir)" $env_dir
assertCaptured "Your build may fail if NO_PROXY is not set to amazonaws.com"
assertCapturedError
}

testWarnAwsProxyHttps() {
env_dir=$(mktmpdir)
echo "http://localhost:5001" > $env_dir/HTTPS_PROXY
compile "node-10" "$(mktmpdir)" $env_dir
assertCaptured "Your build may fail if NO_PROXY is not set to amazonaws.com"
assertCapturedError
}

testWarnUnmetDepNpm() {
compile "unmet-dep"
assertCaptured "fail npm install"
Expand Down

0 comments on commit 50e73aa

Please sign in to comment.