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

Fix Connection Error #1708

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
7 changes: 2 additions & 5 deletions bin/steps/python
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ PYTHON_URL="${S3_BASE_URL}/python-${python_full_version}-ubuntu-${UBUNTU_VERSION
# TODO: Update this message to be more specific once Python 3.8 support is dropped.
if ! curl --output /dev/null --silent --head --fail --retry 3 --retry-connrefused --connect-timeout 10 "${PYTHON_URL}"; then
output::error <<-EOF
Error: Python ${python_full_version} isn't available for this stack (${STACK}).

For a list of the supported Python versions, see:
https://devcenter.heroku.com/articles/python-support#supported-runtimes
Error: Python Connection timeout
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Thank you for the PR.

I agree this error message needs improving (fixing this was in my longer term todo list), since it currently doesn't distinguish between the 404 case and other failure modes.

However, unfortunately this new error message will also not be correct most of the time either. For example:

  • Some Python versions are not available on some stacks (eg Python 3.8 is not available on Heroku-22 and newer)
  • The download could fail for other reasons that aren't a timeout (for example an HTTP 500 from S3 being down)

As such, this change would cause the Python 3.8 tests here to fail:

it 'aborts the build with a version not available message' do
app.deploy do |app|
expect(clean_output(app.output)).to include(<<~OUTPUT)
remote: -----> Python app detected
remote: -----> Using Python 3.8 specified in .python-version
remote:
remote: ! Error: Python #{LATEST_PYTHON_3_8} isn't available for this stack (#{app.stack}).
remote: !
remote: ! For a list of the supported Python versions, see:
remote: ! https://devcenter.heroku.com/articles/python-support#supported-runtimes
remote:
remote: ! Push rejected, failed to compile Python app.
OUTPUT

To fix all cases here, we'll need to inspect the HTTP status code from curl and vary the error message accordingly. Or we could wait until Python 3.8 support is dropped (which will be happening soon), since at that point all Python versions are available on all stacks.

EOF
meta_set "failure_reason" "python-version-not-found"
meta_set "failure_reason" "connection-timeout"
exit 1
fi

Expand Down
Loading