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

Poor stack traces in SSR #7456

Open
1 of 2 tasks
Josh-Cena opened this issue May 20, 2022 · 3 comments
Open
1 of 2 tasks

Poor stack traces in SSR #7456

Josh-Cena opened this issue May 20, 2022 · 3 comments
Labels
bug An error in the Docusaurus core causing instability or issues with its execution domain: dx Related to developer experience of working on Docusaurus sites

Comments

@Josh-Cena
Copy link
Collaborator

Have you read the Contributing Guidelines on issues?

Motivation

Our SSR errors are undebuggable. For example, #7398, #4268.

If a piece of code accesses window, all we know is which path is currently being rendered, but if this code is a client module, then it throws on every single path. Beyond that, when you look into the stack, it, at most, shows something like

Hook useTabGroupChoice is called outside the <TabGroupChoiceProvider>.
ReactContextError
    at useTabGroupChoice (main:38645:1282)
    at ResponseCodeTabs (main:56136:584)
    at d (main:118177:498)
    at bb (main:118180:16)
    at a.b.render (main:118186:43)
    at a.b.read (main:118185:83)
    at Object.exports.renderToString (main:118196:138)
    at doRender (main:29440:417)
    at async serverEntry_render (main:29437:290)

Which isn't really telling us anything.

I don't really know what we need to do specifically to fix this: do we use source maps? Do we do SSR in development mode so that React can give us the component stack? Or do we simply wrap some imports in try/catch (I'm thinking specifically about the client modules)?

Self-service

  • I'd be willing to do some initial work on this proposal myself.
@Josh-Cena Josh-Cena added bug An error in the Docusaurus core causing instability or issues with its execution domain: dx Related to developer experience of working on Docusaurus sites labels May 20, 2022
@slorber
Copy link
Collaborator

slorber commented May 25, 2022

yes, this is also annoying me a lot, not sure what's the best solution to have better SSR stack traces

Using try/catch, does it mean we have to emit those directly inside .docusaurus/clientModules.js or do you have any other idea in mind?

@Josh-Cena
Copy link
Collaborator Author

Yes, that's what I have in mind.

@wenerme
Copy link
Contributor

wenerme commented Oct 25, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution domain: dx Related to developer experience of working on Docusaurus sites
Projects
None yet
Development

No branches or pull requests

3 participants