-
Notifications
You must be signed in to change notification settings - Fork 9
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
NextJS handling of network error #99
Comments
Can you please provide a reproducible example of an app crashing? We already have a way of providing "fallback" flags ( |
Hello Unleash team, I apologize for the delayed response. As a new member of the project, I've discovered some important information regarding the recent incident:
I appreciate your patience as I've just started on the project and honestly thought it was coming from unleash. Please let me know if you need any further clarification or have any questions. Thank you for your understanding. |
Please provide an example causing an app crash. I couldn't reproduce your issue. Network errors are caught in code and printed to the console. There is an option to get errors with listeners (https://docs.getunleash.io/reference/sdks/react#listening-to-events). |
The SDKs are designed to not throw errors but instead allow clients to hook into events and listen to errors and decide how to act upon them themselves. Like Tymek said, you can listen on the error events emitted from the SDK and decide what you do with them when you receive an error. I will close this issue for now, but let me know if that works for you. |
A bit more of context, we create the flag provider just like the unleash website. but we have a function that basically evaluatesFlags(getDefinitions, context) if that didnt return the array we threw an error. It usually works, but if there is a network error in unleash then thats why our app was crashing. Now I would love to create a banner that says to users hey some features might not be working. But because its a server-side function I havent found a way to pass it to a client-side Provider. Is there such feature? I mean we will listen when we mount the component but after that not sure? |
Describe the feature request
Handling Unleash Network Errors in NextJS Applications
Background
Current Situation
In our project, we wrap the app with the Unleash provider/flagProvider. While this generally works well, there's a critical issue:
Current Solution
The current approach to handle this is:
Solution suggestions
Proposed Improvement
A more robust solution could involve:
Implementing a fallback mechanism for
useFlags()
hook:false
for all flags if there's no connectionThis approach would prevent app crashes and allow for graceful degradation.
Implementation Concept
The text was updated successfully, but these errors were encountered: