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: updated error message for attempting to deploy a site with a bad… #6884

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dylanspyer
Copy link
Contributor

🎉 Thanks for submitting a pull request! 🎉

Summary

Fixes: 6736

Previously, netlify deploy with a valid site ID and an invalid auth token would log Error: Site not found. Please rerun "netlify link". Updated this error message to be more clear by logging the message property from the API response when the response status is 401.

Before:
image

After:
image


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)
image

@dylanspyer dylanspyer requested a review from a team as a code owner October 17, 2024 20:56
@khendrikse
Copy link
Contributor

Hi @dylanspyer! Thank you so much for your contribution :) could you maybe still log 'site not found' but also render the error message? I think this could inform our users better on what part of the process went wrong and why?

@dylanspyer
Copy link
Contributor Author

Hi @dylanspyer! Thank you so much for your contribution :) could you maybe still log 'site not found' but also render the error message? I think this could inform our users better on what part of the process went wrong and why?

Thanks for the feedback! I pushed an update with a clearer error message:
image

In this failure case, it's possible that the site id is valid and the auth token is invalid. Logging site not found in that case might be misleading. Let me know your thoughts :) @khendrikse

Copy link
Contributor

@DanielSLew DanielSLew left a comment

Choose a reason for hiding this comment

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

This looks good to me! Just have a request to remove those type errors.

Comment on lines +16 to +18
// @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
if (error_.status === 401) {
// @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix these TS errors with pulling in this PR #6877.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Misleading error message when an invalid NETLIFY_AUTH_TOKEN is provided
3 participants