Skip to content

Conversation

CalebBarnes
Copy link
Contributor

@CalebBarnes CalebBarnes commented Jun 5, 2025

Clean up error logging in auto-install extensions

Problem

The auto-install extensions feature had verbose error logging that would show confusing error messages to users during normal netlify dev usage. The error handling code was also repetitive and lengthy. This is caused by resolve config running in the cli base command and working correctly, but when the dev command calls startDev from build, it is not populating the same config values that auto install extension handler expects.

I also added a try catch to the fetchAutoInstallableExtensionsMeta to gracefully fail and return an empty array if the request fails for whatever reason.

Solution

  • Cleaned up error logging: Consolidated repetitive error handling
  • Made error logging conditional: Error messages now only appear when the debug flag is enabled
  • Improved user experience: Users no longer see confusing "Failed to auto install extension(s): Missing 'accountId'" messages during normal usage

Changes

  1. Added debug parameter to AutoInstallOptions interface and handleAutoInstallExtensions function
  2. Consolidated error checking into a single conditional block with cleaner logic
  3. Made error logging conditional on the debug flag
  4. Passed debug flag from main config resolution to auto-install function

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)

This is a temporary quick fix for incorrect failed to install error logs
when resolve config is run the 2nd time within build
@CalebBarnes CalebBarnes requested a review from a team as a code owner June 5, 2025 19:25
@CalebBarnes CalebBarnes enabled auto-merge (squash) June 5, 2025 19:29
@CalebBarnes CalebBarnes disabled auto-merge June 5, 2025 20:12
@sarahetter sarahetter merged commit 0add4c5 into main Jun 5, 2025
32 of 33 checks passed
@sarahetter sarahetter deleted the fix/failed-to-auto-install-accountid branch June 5, 2025 20:13
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.

2 participants