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

[FEATURE] Support Maintenance Mode 🚧 #1768

Open
johnboxall opened this issue Apr 30, 2024 · 1 comment
Open

[FEATURE] Support Maintenance Mode 🚧 #1768

johnboxall opened this issue Apr 30, 2024 · 1 comment

Comments

@johnboxall
Copy link
Collaborator

johnboxall commented Apr 30, 2024

It would be cool if PWA Kit allowed displaying a "Be right back!" maintenance screen when the associated B2C Commerce instance is in maintenance mode.

B2C Commerce instances can enter maintenance mode two ways:

  1. In BM, you can put your Site's Status into Maintenance.
  2. During the B2C Commerce release process, Salesforce might put your instance into Maintenance.

When B2C Commerce maintenance mode is enabled, requests to SCAPI return an HTTP 503:

https://developer.salesforce.com/docs/commerce/commerce-api/guide/response-handling.html

Today, when a request to SCAPI returns an HTTP 503, PWA Kit renders a generic error.

There are a few ways we could implement this, but one way would be to propogate HTTP 503 errors from SCAPI calls upward to our <ErrorBoundary>.

We might then add special handling for the case where the error is a 503 to <Error>, displaying a user configurable maintenance page.

It looks like lots of the plumbing is already there – we likely need to need to a) make sure errors are passed enough b) make sure we have the details of the error to act on.

For the implementation, we'd want to test maintenance mode being enabled in a few different places:

  1. Server side rendering
  2. Landing on a cached page as a new visitor (eg. call to oauth2/authorize fails)
  3. Landing on a cache page as a returning visitor with valid token (eg. catagory load fails or requests made to navigate to PLP fail)
  4. Basket modifications from the cart page
  5. Basket modifications from the checkout
@johnboxall
Copy link
Collaborator Author

johnboxall commented Jun 15, 2024

This feature should also help you understand when the ODS you're connecting to is stopped or or longer exists.

SCAPI requests to a stopped sandbox returns an HTTP 521 "Web server is down" response.

This should result in a clear error message.

Right now we get this:

Screenshot 2024-06-14 at 8 56 14 PM

The issue only becomes clear when you open DevTools:

Screenshot 2024-06-14 at 8 57 07 PM

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

No branches or pull requests

1 participant