Skip to content

Improve detection error messages#1608

Merged
edmorley merged 2 commits intomainfrom
improve-detect-ux
Jul 1, 2024
Merged

Improve detection error messages#1608
edmorley merged 2 commits intomainfrom
improve-detect-ux

Conversation

@edmorley
Copy link
Copy Markdown
Member

@edmorley edmorley commented Jun 28, 2024

Previously if an app was missing the necessary Python package manager files, buildpack detection would fail with the generic error message provided by the build system (see previous version of test fixtures for an example).

This error message required users to click through to the Dev Center documentation to find out what files need to be present for a Python app to work on Heroku, and there are quite a few support tickets where users have struggled to resolve this themselves (see GUS work item for ticket links).

Now a custom error message is displayed, similar to what the Node.js and PHP buildpacks do:
https://github.com/heroku/heroku-buildpack-nodejs/blob/main/bin/detect
https://github.com/heroku/heroku-buildpack-php/blob/main/bin/detect

This error message lists some common reasons why the files might not be found (such as them not being in the root directory), and also prints a directory listing of the root directory to help the user (and support) understand what is happening.

Lastly, the detection logic has been made more permissive, so that Python apps that are missing some of the required files (but have other misc Python related files) still pass detection, allowing us to perform the stricter file check during the build phase instead. This is particularly important for the "new app with no buildpacks set" case, where in the case of buildpack detect failure a custom detect error message is not shown by the build system (since it's not viable to show the custom message from half a dozen language buildpacks simultaneously), but a build phase error message is.

These changes also bring the classic Python buildpack more in line with the Python CNB implementation:
https://github.com/heroku/buildpacks-python/blob/447c7dd978bc3069fb1baa0005a83e4720ba1e63/src/detect.rs#L4-L25
https://github.com/heroku/buildpacks-python/blob/447c7dd978bc3069fb1baa0005a83e4720ba1e63/src/errors.rs#L71-L81

GUS-W-7924407.

@edmorley edmorley self-assigned this Jun 28, 2024
@edmorley edmorley force-pushed the improve-detect-ux branch from b336fd4 to 871e068 Compare June 28, 2024 14:47
Previously if an app was missing the necessary Python package manager
files, buildpack detection would fail with the generic error message
provided by the build system (see previous version of test fixtures for
an example).

This error message required users to click through to the Dev Center
documentation to find out what files need to be present for a Python app
to work on Heroku, and there are quite a few support tickets where users
have struggled to resolve this themselves (see GUS work item for ticket
links).

Now a custom error message is displayed, similar to what the Node.js and
PHP buildpacks do:
https://github.com/heroku/heroku-buildpack-nodejs/blob/main/bin/detect
https://github.com/heroku/heroku-buildpack-php/blob/main/bin/detect

This error message lists some common reasons why the files might not be
found (such as them not being in the root directory), and also prints a
directory listing of the root directory to help the user (and support)
understand what is happening.

Lastly, the detection logic has been made more permissive, so that
Python apps that are missing some of the required files (but have other
misc Python related files) still pass detection, allowing us to perform
the stricter file check during the build phase instead. This is
particularly important for the "new app with no buildpacks set" case,
where in the case of buildpack detect failure a custom detect error
message is not shown by the build system (since it's not viable to show
the custom message from half a dozen language buildpacks
simultaneously), but a build phase error message is.

These changes also bring the classic Python buildpack more in line with
the Python CNB implementation:
https://github.com/heroku/buildpacks-python/blob/447c7dd978bc3069fb1baa0005a83e4720ba1e63/src/detect.rs#L4-L25
https://github.com/heroku/buildpacks-python/blob/447c7dd978bc3069fb1baa0005a83e4720ba1e63/src/errors.rs#L71-L81

GUS-W-7924407.
@edmorley edmorley force-pushed the improve-detect-ux branch from 871e068 to d55511b Compare June 28, 2024 14:49
@edmorley edmorley marked this pull request as ready for review June 28, 2024 14:52
@edmorley edmorley requested a review from a team as a code owner June 28, 2024 14:52
@edmorley edmorley force-pushed the improve-detect-ux branch from 50d6474 to 3c1380d Compare July 1, 2024 11:09
@edmorley edmorley force-pushed the improve-detect-ux branch from 3c1380d to 7b43c16 Compare July 1, 2024 11:11
@edmorley edmorley enabled auto-merge (squash) July 1, 2024 11:12
@edmorley edmorley merged commit b499813 into main Jul 1, 2024
@edmorley edmorley deleted the improve-detect-ux branch July 1, 2024 11:13
@heroku-linguist heroku-linguist bot mentioned this pull request Jul 1, 2024
@edmorley edmorley mentioned this pull request Sep 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants