Skip to content

Try to stop server if site initialization failed - #565

Merged
fluiddot merged 2 commits into
trunkfrom
fix/stop-server-on-failure
Oct 1, 2024
Merged

Try to stop server if site initialization failed#565
fluiddot merged 2 commits into
trunkfrom
fix/stop-server-on-failure

Conversation

@fluiddot

@fluiddot fluiddot commented Sep 26, 2024

Copy link
Copy Markdown
Contributor

Related to #561 (comment) and https://github.com/Automattic/dotcom-forge/issues/9257.

Proposed Changes

  • This PR doesn't fix 9257-gh-Automattic/dotcom-forge, but handles the case when there's an error during the site initialization and ensures the site can be started again. For instance, it addresses the following case:
    • Have a broken symlink inside the site's folder.
    • Start a site and get a failure.
    • Remove the broken symlink.
    • Start a site will work.

Testing Instructions

  • Run the app with npm start.
  • Create a site and stop it.
  • Click on the Terminal button.
  • Run the command ln -s unknown broken-symlink to create a broken symlink.
  • Start the site.
  • Observe an error message is displayed.
  • Remove the symlink.
  • Start the site again.
  • Observe the site starts and works as expected.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@fluiddot
fluiddot requested a review from a team September 26, 2024 11:13
@fluiddot fluiddot self-assigned this Sep 26, 2024

@sejas sejas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good. I confirm that adding a broken symlink it displays an error alert and do not start the site.
I left a comment about adding more context to the error message.

Screenshot 2024-10-01 at 13 11 10
@@ -267,6 +267,7 @@ export function SiteDetailsProvider( { children }: SiteDetailsProviderProps ) {
"Please verify your site's local path directory contains the standard WordPress installation files and try again. If this problem persists, please contact support."
),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What do you think about including error.message to the alert?
I feel giving some tips to the user to fix the site will help the overall UX.

Something like:
Screenshot 2024-10-01 at 13 12 33

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, good point. This could be helpful when the user contacts support and we need to debug a failure.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we remove the underlying error, e.g., 'Error invoking remote method [...]'?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure about removing it as it's part of the error message, it could be helpful when debugging issues in the future. What we could do is adding a title to that part conveying that's the raw error message, so users don't get confused about the content.

@fluiddot

fluiddot commented Oct 1, 2024

Copy link
Copy Markdown
Contributor Author

@sejas I'm going to merge this as-is and create a new GitHub issue as a follow-up to improve the error messaging.

UPDATE: Here's the issue: https://github.com/Automattic/dotcom-forge/issues/9309

@fluiddot
fluiddot merged commit 39c3ea4 into trunk Oct 1, 2024
@fluiddot
fluiddot deleted the fix/stop-server-on-failure branch October 1, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants