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

warn if http_proxy/https_proxy set and no_proxy is not aws #782

Merged
merged 4 commits into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
lillianzhang331 marked this conversation as resolved.
Show resolved Hide resolved

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