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

Notify developers early if configuration is incorrect #58

Open
angeloashmore opened this issue Jan 11, 2023 · 0 comments
Open

Notify developers early if configuration is incorrect #58

angeloashmore opened this issue Jan 11, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@angeloashmore
Copy link
Member

angeloashmore commented Jan 11, 2023

Is your feature request related to a problem? Please describe.

@prismicio/next requires specific configuration to work properly. For example, <PrismicPreview> must be set up with a properly created preview endpoint, and enableAutoPreviews() requires valid Next.js preview data or an API req object.

Some of this configuration can be analyzed statically to provide in-code-editor errors via TypeScript, but not everyone is using TypeScript, and some configuration can only be analyzed at runtime.

Without notifying developers of misconfiguration in an obvious way, developers likely may not understand errors caused as a result.

Describe the solution you'd like

The most obvious way to signal misconfiguration is crashing the Next.js process. If the server cannot start or build, a developer is more likely to fix the issue.

Alternatively, we can throw errors in the browser, prompting the Next.js error overlay to appear.

We can provide helpful messages and links to guide developers to properly set up their project.

Describe alternatives you've considered

Some errors are logged to the browser console, but they are not obvious. In some cases, such as <PrismicPreview>'s logic to start shared preview links, the page may refresh so quickly that console messages cannot be read.

Additional context

Feature requested by @FuzzyReason

@angeloashmore angeloashmore added the enhancement New feature or request label Jan 11, 2023
@angeloashmore angeloashmore changed the title Notify developers early if configuration is incorrect. Notify developers early if configuration is incorrect Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant