diff --git a/CHANGELOG.md b/CHANGELOG.md index c3061ec96..a501f638e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ - Trap unhandled build errors with dedicated message [David Zuelke] - Summarize all emitted warnings if subsequent build error occurs [David Zuelke] +### FIX + +- stdlib download during build init may theoretically fail on download restart [David Zuelke] + ## v139 (2018-07-20) ### ADD diff --git a/bin/compile b/bin/compile index ac1bd982b..f479d733c 100755 --- a/bin/compile +++ b/bin/compile @@ -27,7 +27,18 @@ source $bp_dir/bin/util/common.sh trap 'err_trap' ERR # stdlib -source /dev/stdin <<< "$(curl_retry_on_18 --silent https://lang-common.s3.amazonaws.com/buildpack-stdlib/v8/stdlib.sh)" +# download to a file first, as the function restarts the entire download on code 18 connection reset (not all servers support -C) +curl_retry_on_18 --fail --silent --location -o $bp_dir/bin/util/stdlib.sh https://lang-common.s3.amazonaws.com/buildpack-stdlib/v8/stdlib.sh || { + error <<-EOF + Failed to download standard library for bootstrapping! + + This is most likely a temporary internal error. If the problem + persists, make sure that you are not running a custom or forked + version of the Heroku PHP buildpack which may need updating. + EOF +} +source $bp_dir/bin/util/stdlib.sh +rm $bp_dir/bin/util/stdlib.sh # failure counting source $bp_dir/bin/util/failures.sh