growthbook / devtools

GrowthBook DevTools extension for Chrome
MIT License
5 stars 5 forks source link

Pass along error messages from network #31

Closed bttf closed 1 year ago

bttf commented 1 year ago

Prior to this change, we were only reporting a generic 'Please check your API Key and host' message for any error that occurred when establishing connection between the visual editor and growthbook API.

Now we are relaying the error message generated by the network request which should be more helpful in troubleshooting

Matt's query params issue from earlier (now reports error specific to api-host query param)

Screenshot 2023-06-20 at 1 43 59 PM

Wrong hostname error ('failed to fetch')

Screenshot 2023-06-20 at 1 43 52 PM
jdorn commented 1 year ago

This is definitely an improvement.

I think we can make this error page a lot smarter. Right now, we always show the API Host and Key inputs, even when the error has nothing to do with them. This may confuse users, no matter how helpful we make the error message.

The issue is that we're doing a complex API call that may fail for a number of different reasons (bad API Host, bad API Key, mangled querystring, CSP errors, etc.). It's hard to figure out exactly why it failed.

If we think of the connection as multiple steps, we can provide really clear feedback to the user about exactly when and why something went wrong.

  1. Connect to the API - Hit the root (e.g. https://api.growthbook.io/), parse the JSON and make sure it's actually the GrowthBook API and not some other random server. Note: the root path does not require an API Key, so we're only testing the host and CSP settings at this point.
  2. Authenticate - Hit a simple endpoint to make sure the API Key is valid (not sure if this exists yet, but should be easy to add)
  3. Load Experiment - Make the actual request to load the visual changeset

We can show check marks for each step as they complete. And we can be smart about which inputs we show. For example, if we're able to connect to the API, but the Authentication fails, we don't have to show the API Host input anymore, just the API Key input.