Add error-handling and versioned logs to Privacy Center to help admins troubleshoot configuration issues
Description
Today, any misconfiguration of the config.json file for the Privacy Center tends to result in a mysterious server crash when it starts. With https://github.com/ethyca/fides/pull/3105 we've retooled the configuration to load at runtime, which gives us a lot more leeway to provide some helpful breadcrumbs for admins to troubleshoot!
We don't need to make this bullet-proof, but a bit of error-handling, validation, and helpful log messages would go a long way.
Acceptance Criteria
- [ ] Log a version number in the
privacy-centerserver logs - [ ] Initialize the Redux store with a safe set of default configuration, but with a "customized = false" state
- [ ] Add a helpful warning in the UI that the configuration hasn't been customized and isn't ready to receive requests 👍
- [ ] Validate the
config.json, either on startup or on page load - [ ] Log helpful validation errors for admins to troubleshoot
- [ ] Show an error page in the UI when configuration errors occur (to avoid confusing end-user UX)
- [ ] Cleanup any other miscellaneous TODOs from the https://github.com/ethyca/fides/pull/3105 refactor
Implementation Notes
From @TheAndrewJackson:
Zod can be used to validate the config. It's essentially pydantic but for typescript. It's super powerful!
This might helpful too. There is a package called t3-env that will uses a zod schema to validate env vars on startup. If any are missing or invalid it will fail startup and let the user know what's missing.
That looks interesting...!
copy/pasta of my comment from the PR to keep the convo closer to the issue:
Zod can be used to validate the config. It's essentially pydantic but for typescript. It's super powerful!
This might helpful too. There is a package called t3-env that uses a zod schema to validate env vars on startup. If any are missing or invalid it will fail the startup and let the user know what's missing.
@mfbrown is this captured somewhere with our DSR roadmap work?